Events: record

Records a batch of changes to the number of times events have occurred for the currently authenticated user of this application. Try it now.

Request

HTTP request

POST https://www.googleapis.com/games/v1/events

Parameters

Parameter name Value Description
Optional query parameters
language string The preferred language to use for strings returned by this method.

Authorization

This request requires authorization with the following scope:

Scope
https://www.googleapis.com/auth/games

For more information, see the authentication and authorization page.

Request body

In the request body, supply data with the following structure:

{
  "kind": "games#eventRecordRequest",
  "requestId": long,
  "currentTimeMillis": long,
  "timePeriods": [
    {
      "kind": "games#eventPeriodUpdate",
      "timePeriod": {
        "kind": "games#eventPeriodRange",
        "periodStartMillis": long,
        "periodEndMillis": long
      },
      "updates": [
        {
          "kind": "games#eventUpdateRequest",
          "definitionId": string,
          "updateCount": long
        }
      ]
    }
  ]
}
Property name Value Description Notes
kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventRecordRequest.
requestId long The request ID used to identify this attempt to record events.
currentTimeMillis long The current time when this update was sent, in milliseconds, since 1970 UTC (Unix Epoch).
timePeriods[] list A list of the time period updates being made in this request.
timePeriods[].kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventPeriodUpdate.
timePeriods[].timePeriod nested object The time period being covered by this update.
timePeriods[].timePeriod.kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventPeriodRange.
timePeriods[].timePeriod.periodStartMillis long The time when this update period begins, in millis, since 1970 UTC (Unix Epoch).
timePeriods[].timePeriod.periodEndMillis long The time when this update period ends, in millis, since 1970 UTC (Unix Epoch).
timePeriods[].updates[] list The updates being made for this time period.
timePeriods[].updates[].kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventUpdateRequest.
timePeriods[].updates[].definitionId string The ID of the event being modified in this update.
timePeriods[].updates[].updateCount long The number of times this event occurred in this time period. writable

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "games#eventUpdateResponse",
  "batchFailures": [
    {
      "kind": "games#eventBatchRecordFailure",
      "range": {
        "kind": "games#eventPeriodRange",
        "periodStartMillis": long,
        "periodEndMillis": long
      },
      "failureCause": string
    }
  ],
  "eventFailures": [
    {
      "kind": "games#eventRecordFailure",
      "eventId": string,
      "failureCause": string
    }
  ],
  "playerEvents": [
    {
      "kind": "games#playerEvent",
      "definitionId": string,
      "playerId": string,
      "numEvents": long,
      "formattedNumEvents": string
    }
  ]
}
Property name Value Description Notes
kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventUpdateResponse.
batchFailures[] list Any batch-wide failures which occurred applying updates.
batchFailures[].kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventBatchRecordFailure.
batchFailures[].range nested object The time range which was rejected; empty for a request-wide failure.
batchFailures[].range.kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventPeriodRange.
batchFailures[].range.periodStartMillis long The time when this update period begins, in millis, since 1970 UTC (Unix Epoch).
batchFailures[].range.periodEndMillis long The time when this update period ends, in millis, since 1970 UTC (Unix Epoch).
batchFailures[].failureCause string The cause for the update failure.
Possible values are:
  • "TOO_LARGE": A batch request was issued with more events than are allowed in a single batch.
  • "TIME_PERIOD_EXPIRED": A batch was sent with data too far in the past to record.
  • "TIME_PERIOD_SHORT": A batch was sent with a time range that was too short.
  • "TIME_PERIOD_LONG": A batch was sent with a time range that was too long.
  • "ALREADY_UPDATED": An attempt was made to record a batch of data which was already seen.
  • "RECORD_RATE_HIGH": An attempt was made to record data faster than the server will apply updates.


Acceptable values are:
  • "ALREADY_UPDATED"
  • "RECORD_RATE_HIGH"
  • "TIME_PERIOD_EXPIRED"
  • "TIME_PERIOD_LONG"
  • "TIME_PERIOD_SHORT"
  • "TOO_LARGE"
eventFailures[] list Any failures updating a particular event.
eventFailures[].kind string Uniquely identifies the type of this resource. Value is always the fixed string games#eventRecordFailure.
eventFailures[].eventId string The ID of the event that was not updated.
eventFailures[].failureCause string The cause for the update failure.
Possible values are:
  • "NOT_FOUND" - An attempt was made to set an event that was not defined.
  • "INVALID_UPDATE_VALUE" - An attempt was made to increment an event by a non-positive value.


Acceptable values are:
  • "INVALID_UPDATE_VALUE"
  • "NOT_FOUND"
playerEvents[] list The current status of any updated events
playerEvents[].kind string Uniquely identifies the type of this resource. Value is always the fixed string games#playerEvent.
playerEvents[].definitionId string The ID of the event definition.
playerEvents[].playerId string The ID of the player.
playerEvents[].numEvents long The current number of times this event has occurred.
playerEvents[].formattedNumEvents string The current number of times this event has occurred, as a string. The formatting of this string depends on the configuration of your event in the Play Games Developer Console.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.