Skip to main content

Vitally's HTTPS Analytics API - Batch

Analytics API - Batch

Written by Laura Bedoya
Updated yesterday

Replace {subdomain} in the endpoint below with your Vitally subdomain.

You can find your subdomain in the URL used to log into Vitally (i.e., https://yoursubdomain.vitally.io

Create/update a batch of Organizations, Accounts, Users, Tracks, or Custom Object Instances

The batch API allows sending Organization, Account, User, Track, or Custom Object Instance messages in batches instead of one at a time. It is ideal for importing historical data into Vitally.

Batch size

The maximum number of messages in a batch is 100.

Headers

Name

Type

Description

Authorization*

string

Set to Basic [YOUR_API_TOKEN]

Content-Type*

string

Set to application/json

200 Cake successfully retrieved.

{"message":"Success."}

Request body

The body of the request should be a JSON array whose elements are Organization, Account, User, Track, or Custom Object Instance messages. Each message in the batch should have the additional field:

  • type: Indicates the type of message. Must be either "organization", "account", "user", "track", "customobjectinstance", or "unlink"

Example

An example batch containing an organization, account, user, track, and custom object instance would look like:

curl -X POST https://{subdomain}.api.vitally.io/analytics/v1/batch \
-H "Authorization: Basic [your token]" \
-H "Content-Type: application/json" \
-d '[
{
"type": "organization",
"organizationId": "abcdefg",
"traits": {
"name": "World Cup",
"sport": "futbol"
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4915",
"timestamp": "2018-05-15T12:31:12.123Z"
},
{
"type": "account",
"accountId": "123456",
"organizationId": "abcdefg",
"traits": {
"name": "Argentina",
"group": "D"
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4915",
"timestamp": "2018-05-15T12:31:12.123Z"
},
{
"type": "user",
"userId": "32",
"accountId": "123456",
"organizationId": "abcdefg",
"traits": {
"name": "Lionel Messi",
"position": "Forward",
"number": 10,
"email": "messi@barcelona.sp"
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4915",
"timestamp": "2018-05-15T12:31:12.123Z"
},
{
"type": "track",
"userId": "32",
"event": "scored-goal",
"properties": {
"minute": 14,
"opponentId": 421243,
"matchId": 9
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4915",
"timestamp": "2018-05-15T12:31:12.123Z"
},
{
"type": "customobjectinstance",
"externalId": "coi-789xyz",
"customObjectId": "2a3a47e7-459e-440e-b9d3-9fc1b11f233e",
"name": "Q1 Renewal - Argentina",
"accountId": "123456",
"traits": {
"vitally.custom.stage": "Negotiation",
"vitally.custom.dealValue": 50000,
"vitally.custom.closeDate": "2018-06-30T00:00:00.000Z"
},
"messageId": "7ac1c682-a54b-4d0d-9f56-d6d3618f4916",
"timestamp": "2018-05-15T12:31:12.123Z"
}
]
Did this answer your question?