Sessions Input
Route for sending a session (store visit) to Trax
API endpoint for submitting Session information as part of Visit Data
PUT /api/:version_number/:project_name/session/:session_uid
curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" -X PUT https://services.traxretail.com/api/v4/my-project/sessions/my-session-UID
Supported Protocol: HTTPS
PUT
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Query Parameters
version_number string *
The current implemented API version. <Major> version (e.g. 'v4')
project_name string *
Project name as provided by Trax
session_uid string *
UUID generated by the client for the session
UUID v.4
The session will be generated at the beginning of the session and will be used throughout the session, for example, when sending Scenes and their Images
Request Details
Mandatory fields marked indicated by *
client_session_uid string (100)
Identifier provided by the client for the session.
This value is not checked for uniqueness by Trax, and can be used to map the session object in the Analysis Results
store_number string (100) *
Client's Store unique identifier, as provided in Stores
visit_date string (YYYY-MM-DD)*
The date of the visit by local time zone
session_start_time number (Epoch Unix Time timestamp)*
The Unix Epoch timestamp of the session start time in the client application
visit_type_id number (255)
Primary key (pk) of the Visit Type the session should be assigned to. Contact Trax project team to get the table values
session_end_time number (Epoch Unix Time timestamp)
The Unix Epoch timestamp of the session end time in the client application
email_address string (255)
The email of the user conduction the session.
If this value is provided, it must correlate to an email address of a user as sent in Users (V4 or V5)
scenes Object[] *
List of Scenes containing the following values:
scene_uid string (100)*
UUID generated by the client for the scene
task_code string Required for PUREAI Solution
Scene corresponding Task code that has been configured in coordination with Trax implementation team
Request Body
Mandatory fields marked indicated by *
Request Body Example
{
"client_session_uid": "My_session_uid",
"store_number": "100050000000008",
"visit_date": "2017-06-02",
"email_address": "john@example.com",
"session_start_time": 1496587649,
"session_end_time": 1492041645,
"visit_type_id": 801,
"scenes": [
{
"scene_uid":"31d746d6-ba97-41db-b201-2dd448323e12",
"task_code": "1"
},
{
"scene_uid":"31d746d6-ba97-41db-b201-2dd448323e123",
"task_code": "2"
},
{
"scene_uid":"31d746d6-ba97-41db-b201-2dd448323e124", "task_code": "3"
}
]
}
Validation and Errors
When uploading the Session, the Trax system runs numerous validations on the file to confirm it has all the necessary fields.
Should there be issues with the upload, an error code and error will be returned. It will contain one the following errors based on failing the related validation:
Session already received
-
Error Code: 409 - Conflict
-
Error: Session has already been received
Mandatory Variables
-
Error Code: 400 - Bad Request
-
Error:
missing attribute - <field_name>
OR
missing attributes - <field_name>,<field_name>...
Variable Types
-
Error Code: 400 - Bad Request
-
Error:
missing mandatory field - <field_name>
OR
missing mandatory fields - <field_name>,<field_name>...
Unknown Store
-
Error Code: 400 - Bad Request
-
Error: Unknown Store <request_store_identifier_>
Lookup Value does not exist
-
Error Code: 400 - Bad Request
-
Error: Lookup value does not exist: <lookup_value>
Incorrect Format
-
Error Code: 400 - Bad Request
-
Error:
Incorrect format field: <field_name>,
the correct format: <correct_format>
Internal Server Error
-
Error Code: 500 - Internal Sever Error
-
Error: Trax Internal Error
Incorrect or expired token
-
Error Code: 401 - Unauthorized
-
Error: Incorrect or expired token
Requesting a forbidden resource
-
Error Code: 403 - Forbidden
-
Error: A forbidden resource has been requested <resource>