Skip to content

Kabam Bulk Event Load REST API

Jim Lake edited this page Apr 14, 2015 · 2 revisions

Welcome to the Data Cortex Kabam Bulk Ingest API.

API Endpoint

All calls are made on the api endpoint:

https://api.data-cortex.com

Request

Calls to the API are made with a POST to the API endpoint.

POST /<org>/1/kabam_bulk_track

<org> - string - Should be replaced with the organization short name.

Request Parameters

The request should contain a JSON body. The client should be sure to set the the Content-Type header to "application/json". Arguments are required unless noted otherwise.

api_key - string - The api key specific to this application. Applications can have more than 1 API key, but can not be shared between applications.

transaction_id - string - A unique transaction ID generated by the client to prevent duplicate uploads. This would usually be generated as a random number and stored as the file name or as a hash of the contents of the source.

events - list of object - A list of events to import for this application.

Event Contents

Events schema roughly falls along the following schema. One of idfa, gps_adid, or mac_md5 should be included on each event to indicate the device of the user. Optional elements should not be included in the JSON.

timestamp - string - ISO8601 string of the event timestamp (e.g. 2015-02-08T23:58:19.547Z)

app_ver - string - App version

server_ver - string - Server version

online_status - string - Online status of the device when the event occurred. The following values should be used:

offline, online-wifi, online-cellular

base_id - string - Base ID for user, used as user_tag.

idfa - string - (optional) IDFA for user

gps_adid - string - (optional) Google Play Services Advertising ID.

mac_md5 - string - (optional) MD5 of device MAC.

os - string - OS for user

os_ver - string - OS version

device_type - string - Device type for user

device_family - string - Device family

marketplace - string - Marketplace for this user

country - string - The uppercase 2 letter ISO 3166-1 alpha-2 country.

language - string - The lowercase 2 letter ISO 639-1 language code.

event - string - Custom event type from TapZen

Additional properties should be included based on the event type.

Response

The API responds with the following depending on the result.

Success

The events have been received.

HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: text/plain; charset=utf-8
Content-Length: 2
Date: Thu, 04 Dec 2014 22:04:42 GMT
Connection: keep-alive

OK

Bad Request

Bad request. Check with Data Cortex documentation and verify that you are sending all required fields and valid data types in those fields. Production clients should treat this as a fatal error and not retry the request.

HTTP/1.1 400 Bad Request

Auth Failure

Bad API key. Check with Data Cortex and verify your API key. Production clients should treat this as a fatal error and not retry the request.

HTTP/1.1 403 Forbidden

Transaction Repeated

This transaction has already been recorded. This indicated you previously sent this set of events and they were successfully processed. You should treat this as success.

HTTP/1.1 409 Conflict

Request Entity Too Large

This request exceeded the maximum size. Current maximum is set at 50MB.

HTTP/1.1 413 Request Entity Too Large

Rate Limit Reached

Too many simulations requests for this organization. This should be treated as a back-off to reduce concurrency.

HTTP/1.1 429 Rate Limit Reached

All other error codes.

Internal server error. Clients should treat these as soft errors and retry.

HTTP/1.1 500 Internal Server Error

Example

CURL

curl 'https://api.data-cortex.com/example/1/kabam_bulk_track' -H 'Content-Type: application/json' --data-binary '{"api_key":"123456789","transaction_id":"adfc317adf8d6a137678513689","events":[{"timestamp":"2015-02-08T23:47:57.848Z","os":"iPhone OS","os_version":"7.1","device_type":"iPhone4,1","country":"BR","language":"pt","base_id":"54d7f5adebcdc58XXXXXXX","user_id":"54d7f5aceXXXXXX","device_id":"420098b3-6a4d-4d25-a493-XXXXXXXXXX","sid":"54d7f5adebcdcXXXXXXX","variant":"default","idfa":"18D1CE65-40F6-498B-82A3-XXXXXXXXXX","context":"nue","event":"base_created"},{"timestamp":"2015-02-08T23:47:59.605Z","base_id":"53caaad5a14cfXXXXXXX","variant":"aaaacaaa","sid":"54d7f55f2f53XXXXXX","duration":79,"reason":"background","os":"iPhone OS","os_version":"8.1.3","device_type":"iPad3,1","country":"US","language":"en","idfa":"18D1CE65-40F6-498B-82A3-XXXXXXXXXX","context":"session","event":"session_end"}]}' -D - --trace-ascii -

Request

POST /example/1/kabam_bulk_track HTTP/1.1
User-Agent: curl/7.37.1
Host: api.data-cortex.com
Accept: */*
Content-Type: application/json
Content-Length: 826

{"api_key":"123456789","transaction_id":"adfc317adf8d6a137678513689","events":[{"timestamp":"2015-02-08T23:47:57.848Z","os":"iPhone OS","os_version":"7.1","device_type":"iPhone4,1","country":"BR","language":"pt","base_id":"54d7f5adebcdc58XXXXXXX","user_id":"54d7f5aceXXXXXX","device_id":"420098b3-6a4d-4d25-a493-XXXXXXXXXX","sid":"54d7f5adebcdcXXXXXXX","variant":"default","idfa":"18D1CE65-40F6-498B-82A3-XXXXXXXXXX","context":"nue","event":"base_created"},{"timestamp":"2015-02-08T23:47:59.605Z","base_id":"53caaad5a14cfXXXXXXX","variant":"aaaacaaa","sid":"54d7f55f2f53XXXXXX","duration":79,"reason":"background","os":"iPhone OS","os_version":"8.1.3","device_type":"iPad3,1","country":"US","language":"en","idfa":"18D1CE65-40F6-498B-82A3-XXXXXXXXXX","context":"session","event":"session_end"}]}

Response

HTTP/1.1 200 OK
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: *
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 3600
Cache-Control: no-cache, no-store, must-revalidate
Content-Type: text/plain; charset=utf-8
Date: Mon, 09 Feb 2015 23:45:15 GMT
Server: nginx/1.4.6 (Ubuntu)
Vary: X-HTTP-Method-Override
X-Powered-By: Express
Content-Length: 2
Connection: keep-alive

OK

Clone this wiki locally