PlayStream Events - Write Events

Write batches of entity based events to PlayStream. The namespace of the Event must be 'custom' or start with 'custom.'.

POST https://titleId.playfabapi.com/Event/WriteEvents

Request Header

Name Required Type Description
X-EntityToken True

string

This API requires an Entity Session Token, available from the Entity GetEntityToken method.

Request Body

Name Required Type Description
Events True

EventContents[]

The collection of events to write. Up to 200 events can be written per request.

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Responses

Name Type Description
200 OK

WriteEventsResponse

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-EntityToken

This API requires an Entity Session Token, available from the Entity GetEntityToken method.

Type: apiKey
In: header

Definitions

Name Description
ApiErrorWrapper

The basic wrapper around every failed API response

EntityKey

Combined entity type and ID structure which uniquely identifies a single entity.

EventContents
WriteEventsRequest
WriteEventsResponse

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

EntityKey

Combined entity type and ID structure which uniquely identifies a single entity.

Name Type Description
Id

string

Unique ID of the entity.

Type

string

Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types

EventContents

Name Type Description
CustomTags

object

The optional custom tags associated with the event (e.g. build number, external trace identifiers, etc.). Before an event is written, this collection and the base request custom tags will be merged, but not overriden. This enables the caller to specify static tags and per event tags.

Entity

EntityKey

Entity associated with the event. If null, the event will apply to the calling entity.

EventNamespace

string

The namespace in which the event is defined. Allowed namespaces can vary by API.

Name

string

The name of this event.

OriginalId

string

The original unique identifier associated with this event before it was posted to PlayFab. The value might differ from the EventId value, which is assigned when the event is received by the server.

OriginalTimestamp

string

The time (in UTC) associated with this event when it occurred. If specified, this value is stored in the OriginalTimestamp property of the PlayStream event.

Payload

object

Arbitrary data associated with the event. Only one of Payload or PayloadJSON is allowed.

PayloadJSON

string

Arbitrary data associated with the event, represented as a JSON serialized string. Only one of Payload or PayloadJSON is allowed.

WriteEventsRequest

Name Type Description
CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Events

EventContents[]

The collection of events to write. Up to 200 events can be written per request.

WriteEventsResponse

Name Type Description
AssignedEventIds

string[]

The unique identifiers assigned by the server to the events, in the same order as the events in the request. Only returned if FlushToPlayStream option is true.

Error Codes

Name Code
EncryptionKeyBroken 1291
EventEntityNotAllowed 1372
EventNamespaceNotAllowed 1371
InvalidEventContents 1548
InvalidJSONContent 1200
PerEntityEventRateLimitExceeded 1392