stats
The stats
API allows posting arbitrary data to be stored in the portal database.
POST Parameters (single stat)
This API requires a POST HTTP request.
- api_key (string) Required - The API key for the account
- stat (object) Required - A single stat object
POST Parameters (multiple stats)
This API requires a POST HTTP request.
- api_key (string) Required - The API key for the account
- stats (object) Required - An array of stat objects
Stat object
- user_id (integer) Optional - A Tastevin user id
- stat_type (integer) Required - Type of statistic. See below for valid stat types.
- value (string) Optional - Data to be stored for this statistic. Maximum length is 1024 characters.
- collected_at (datetime) Optional - Date and time that the statistic was collected. The parameter should be formatted as "YYYY-MM-DD HH:MM:SS" and will be interpreted as a UTC date and time value.
- table_id (string) Required - Arbitrary identifier. This is expected to be globally unique across all deployed Tastevin clients. Maximum length is 255 characters.
- list_id (string) Optional - Identifier of related list. See below for conventions on list id.
list_id parameter
The list_id parameter identifies the related list in a globally unique manner. To construct it:
- For a beverage SKU list, use "B" plus the beverage SKU list id (such as "B123")
- For a menu, use "M" plus the menu id (such as "M123")
- For meal pairings, use "P" with no additional number (such as "P")
Response
The stats
API returns a status of "created" or an array of errors if the stats could not be created.
Stat Types
- 0 - Beverage view. Value should be the beverage SKU ID.
- 1 - Menu item view. Value should be the menu item ID.
- 2 - Beverage consideration. Value should be the beverage SKU ID.
- 3 - Menu item consideration. Value should be the menu item ID.
- 4 - Search performed. Value should be the search term used. List id should be the current list (if any).
- 5 - Table closing. Value should be null.
- 6 - Hard sync completed. Value should be null.
- 7 - Full size image viewed. Value should be the asset ID.
- 8 - Video viewed. Value should be the asset ID.
- 9 - RESERVED FOR PORTAL USE.
- 10 - Hard sync duration. Value should be the number of seconds clock time that the sync required.
- 11 - Incremental sync duration. Value should be the number of seconds clock time that the sync required.
- 12 - No Sync warning displayed. Value should be null.
- 13 - iPad name. Value should be the name of the sending iPad.
- 14 - Missed sync. Value should be null.
- 15 - Successfully started sync. Value should be the null.
- 16 - Product view. Value should be the product ID.
- 17 - Product consideration. Value should be the product ID.
Sample Payloads
To create a single stat object:
{
"api_key":"ABCDEF123456",
"stat":{
"stat_type":1,"value":"27","table_id":"ABCDEF","list_id":"M123"
},
}
To create multiple stat objects:
{
"api_key":"ABCDEF123456",
"stats":[
{
"stat_type":1,"value":"27","table_id":"ABCDEF","list_id":"M123"
},
{
"stat_type":2,"value":"48","table_id":"ABCDEF"
}
]
}