Notifier
One of the ways to receive the Analysis Results file to your company's system is via the "push" model. This is called the notifier. This feature require Subscription. Upon subscription, Trax services will send you a POST request that will contain link the analysis results documented generated called Notifications. In this section, we will detail the Subscriptions requests and the Notification content
Subscription
GET /api/notifier/public/:project_name/subscription
curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" https://services.traxretail.com/api/notifier/public/my-project/subscription
Supported Protocol: HTTPS
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Query Parameters
project_name string *
Project name as provided by Trax
Request Details
Mandatory fields marked indicated by
*
{
"statusCode": 404,
"message": "Not Found"
}
-> No Configuration
Status Code: 200 OK
{
"last_update_time": "2023-02-16T15:03:17.508Z",
"user_name": ":project-api-user",
"url_list": [
"https://noti-fier.url1.me/list",
"https://noti-fier.url2.me/list"
],
"wave_type_list": [
"primary"
]
}
Response
GET
analysis_result_url string
URL to the Analysis Result JSON file
session_uid string
UID of the session that the Analysis Result file was generated for
source string
Who created the Notification
Notifier Body Example
{
"analysis_result_url":"https://services.traxretail.com/crypt/traxus/eJfWu%2FhxyFwCL
SB4HfXcbXe92HIBGOSCUCihSf7ArhJwM4P
jbZxn4U%2FJjm2myweYDjpGDCNiEWUFVPix",
"session_uid":"956b22ad-1819-4289-9e2e-6096d8e52223",
"source":"Trax Retail"
}
Status Code: 200 OK
[
"all",
"primary",
"recalculate"
]
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Notifications
Based subscription and session life cycle, Trax will send a POST request to the provided URL. There can be multiple notification per cycles (Live analysis results generation, Offline analysis results generation).
The POST Request
The POST request's body will contain the following fields:
PUT
PUT /api/notifier/public/:project_name/subscription
curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" "Content-Type: application/json"
PUT "https://services.traxretail.com/api/notifier/public/my-project/subscription"
data-raw
{
"url_list": ["https://noti-fier.url1.me/list"],
"wave_type_list": ["primary"]
} '
Request Details
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Content-Type string
Value: application/json
Query Parameters
project_name string *
Project name as provided by Trax
url_list string *
list of URL you want to be notified to
wave_type_list string *
Type of waves you want to be notified on
Possible values:
'primary': Will send a notification when the session complete the main flow of Trax.
'recalculate': Will send a notification for secondary flow type of Trax. Used for data correction, usually happen in batch based Support request.
'all': Will send a notification for the session for every kind of wave types
Response
Status Code: 200 OK
-> Subscription done
Status Code: 400 Bad Request
{
"statusCode": 400,
"message": [
"url_list should not be empty",
"url_list must be an array",
"wave_type_list should not be empty",
"each value in wave_type_list must be a valid enum value",
"wave_type_list must be an array"
],
"error": "Bad Request"
}
DEL
DEL /api/notifier/public/:project_name/subscription
curl -g DEL "Authorization: Auth-Token YOUR_PROJECT-API-KEY" https://services.traxretail.com/api/notifier/public/my-project/subscription
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Query Parameters
project_name string *
Project name as provided by Trax
Request Details
Response
Status Code: 200 OK
-> Subscription deleted
Status Code: 404 Not Found
"error": "Not Found"
Wave types
Trax can add wave types in it's factory in the future. It's possible to control the current list of available wave type of a project.
GET
GET /api/notifier/public/wave-types
curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" https://services.traxretail.com/api/notifier/public/wave-types
Request Details
Mandatory fields marked indicated by
*