REST API – Track Events

We offer two options for submitting events to our REST API: submitting one event at a time, or submitting batches of events.

Track a Single Event

Our REST API’s single event endpoint is

https://api.indicative.com/service/event

or

https://api.indicative.com/service/event/{Your API KEY}

To send us an event, you’ll need to make a POST request to that URL with a Content-Type of ‘application/json’. In the POST body, include a JSON object with the following fields:

Name Type Description
apiKey String The API Key for this project. If the key you provide is invalid, we’ll return a 400 Bad Request error.
eventName String The name of the event. Must be between 1 and 255 characters in length, and cannot be null.
eventUniqueId String The unique identifier for the user triggering the event. Must be between 1 and 255 characters in length, and cannot be null.
properties JSON Object An internal JSON Object, listing property names and values as Strings. Values will be truncated at 255 characters.
eventTime Number The time that the event occurred. The value should be in unix timestamp (either in seconds or milliseconds) or ISO 8601 format. This field is optional, and will default to the current time if not set. Events with negative timestamps (i.e., dates before 1970 UTC) will be rejected.

 

As an example, your JSON Object would resemble the following:

{
    "apiKey": "Your-API-Key",
    "eventName": "Registration",
    "eventUniqueId": "user47",
    "properties":{
        "Gender": "Female",
        "Age": "23"
    }
}

Our servers will respond with one of a few status codes indicating the outcome of your request:

Status Code Description
200 OK Your request successfully reached our servers and used the correct syntax.
400 Bad Request Your request contained malformed syntax. This may indicate that the API Key you used is incorrect.
422 Unprocessable Entity Your request used the correct syntax, but one or more JSON field values violated the constraints listed above.

 


Track a Batch of Events

To send multiple events at once, you’ll want to use our batch endpoint at:

https://api.indicative.com/service/event/batch

It works similarly to the single event endpoint – it requires a POST with Content-Type: ‘application/json’ and a POST body containing the following:

Name Type Description
apiKey String The API Key for this project. If the key you provide is invalid, we’ll return a 400 Bad Request error.
events JSON Array The events to be recorded, in an array. Each object in this array should adhere to the format used to send up a single event, indicated above. The ‘apiKey’ field used in the single event is unnecessary here, and will be disregarded if included.

We recommend that your implementation include up to 100 events per batch. All events sent in a batch default to the current time. To override this, you can set the “eventTime” key for each event to a specific Unix timestamp value. As an example, a batch of two events that would be assigned with the current time would resemble the following:

{
        "apiKey": "Your-API-Key",
        "events": [
            {
                "eventName": "Registration",
                "eventUniqueId": "user47",
                "properties":{
                    "Gender": "Female",
                    "Age": "23"
                }
            },
            {
                "eventName": "Log-In",
                "eventUniqueId": "user752",
                "properties":{
                    "Gender": "Male",
                     "Age": "31"
                }
            }
        ]
}

The status codes returned by the batch endpoint are the same as the single event endpoint specified above. When sending either single or batched events, there is a rate limit of 250 events per second. If you need a higher rate limit, please contact support@indicative.com.

0 users found this helpful