Gameball event API endpoint allows you to record your player's actions in order to track their journey within Gameball widget.
The event APIs help you record any actions your user performs, along with any properties or metadata that describe the action. For further elaboration on events, check this article in our Help Center.
Each action is known as an event. Each event has a name, like place_order, and metadata, for example a place_order event might have properties like amount or source. Calling events is one of the first steps to getting started with Gameball.
The event API call accepts a collection of event to help tracking multiple user actions. Event object is described in Object Reference.
Events can be sent along with points reward and points redemption using Actions Composite API endpoint.
Event
POST/integrations/event
The API call is used to send an event to Gameball where the received event will be evaluated and counted toward player challenges
Headers
Name
Type
Description
APIKey
string
Client API Key
Request Body
Name
Type
Description
events
object
Collection of player events to be sent to Gameball.
playerUniqueId
string
Player unique identifier used to uniquely identify the player on Gameball.
playerAttributes
object
An object containing all of the attributes of the player.
Player object is described in Object Reference section.
{}
{"code": 4,"message": "The PlayerUniqueId field is required."}
{}
{}
In case the player doesn't exist on Gameball before sending the Event API call, the player will be created automatically on Gameball.
Usage Examples
Example One
The below represents events done by a player with playerUniqueId “player123” on two events:
Event “place_order”: (An event that has 2 metadata keys)
total_amount: Total money paid by the player
category: Type of products being bought by player
Event review: (An event with no metadata)
curl -XPOST-H'apiKey: 807b041b7d35425988e354e1f6bce186'-d '{"events": {"place_order": { // Events with metadata"total_amount":"100","category": ["electronics","cosmetics" ] },"review": { } // For events with no metadata },"playerUniqueId": "player123" }' -v -i 'https://api.gameball.co/api/v2.0/integrations/event'
The below example shows how playerAttributes object can be sent with the request to create or update player data, while triggering an event:
Event reserve: An event with one metadata key
rooms: Types of rooms booked by player, 1 for standard and 2 for deluxe rooms
Note: All attributes inside the playerAttributes object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes object.
The below example shows how playerAttributes object including custom attributes object can be sent with the request to create or update player data, while triggering an event:
Event reserve: An event with one metadata key
rooms: Types of rooms booked by player, 1 for standard and 2 for deluxe rooms
Note: All attributes inside the playerAttributes object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes object.
API consumer can provide any number of events given that each event name is not replicated
API consumer can provide from 0 to all event metadata keys, however the keys must not be replicated. If the consumer has multiple values for a single metadata key it should be provide as an array of strings as follows “key”: [“value1”, “value2”, “value3”, …]