Metadata File
A method to update Trax with general metadata files, commonly used for configuration for KPI-related metadata
Query the metadata file job status
Send metadata files
POST
Supported Protocol: HTTPS
type string *
Allowed Values: 'kpi', 'assortment', 'targets'
The entity for which this job applies for
file FILE *
The actual transmitted file (Maximum file size 50 megabyte)
POST /api/:version_number/:project_name/metadata-file
curl -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" -X POST https://services.traxretail.com/api/v4/my-project/metadata-file
Metadata file received
File received without issue
-
HTTP Code: 202 Accepted
Incorrect Request
Error parsing request
-
HTTP Code: 400 - Bad Request
Empty File received
Received file empty is empty
-
HTTP Code: 400 - Bad Request
Request Details
Mandatory fields marked indicated by
*
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Content-Type string
Value: 'multipart/form-data'
Include the boundary string you're using to identify the different parts of the request.
For example:
Content-Type: multipart/form-data;
boundary=YOUR_CUSTOM_BOUNDARY
Content-Length number
Set to the total number of bytes in the request body
Query Parameters
version_number string *
The current implemented API version. <Major> version (e.g. 'v4')
project_name string *
Project name as provided by Trax
Mandatory fields marked indicated by
Format the body according to the multipart/form-data content type [https://tools.ietf.org/html/rfc7578], which contains a set of key-value pairs in the following format:
Request Body
*
The metadata file POST reply body will contain the following field:
Response Details
Validation
When uploading the file, the Trax system runs numerous validations on the file to confirm it has all the necessary fields. Below are the HTTP codes for the metadata file:
Response Example
{
"file_id":"5ae852ff9b894a27avfrt"
}
file_id string
The id of the meta-data file
GET
Request
Supported Protocol: HTTPS
_id string
Id of the metadata file
project string
Project name
type string
The entity for which this job applies for. One of 'kpi', 'assortment', 'targets'
file_url string
URL of the metadata file
file_name string
Name of the metadata file
status string
Status of the metadata file
Possible values:
'queued': The metadata job is pending on Trax side
'in progress':The metadata job is currently running
'done':The metadata job completed successfully
'failed':The metadata job was unable to be completed. Please contact support.
creation_time string in ISODate format
Time the file was created
output Object
Result of the POST request containing the following fields:
output_message string
Message associated with the output
errors Object
Errors associated with processing the submitted metadata file
log_file string
URL of log file associated with processing the metadata file
result number
Status of the POST request. A result of 100 means it was processed correctly. A result of 500 means there was an error
warnings Object
Warnings associated with processing the submitted metadata file
Request Headers
Authorization string
Value: 'Auth-Token {project auth token}'
Authentication token provided by Trax
Content-Type string
Value: 'multipart/form-data'
Include the boundary string you're using to identify the different parts of the request.
For example:
Content-Type: multipart/form-data;
boundary=YOUR_CUSTOM_BOUNDARY
Content-Length number
Set to the total number of bytes in the request body
Query Parameters
version_number string *
The current implemented API version. <Major> version (e.g. 'v4')
project_name string *
Project name as provided by Trax
metadata-file-id string *
ID of the metadata file requested
GET /api/:version_number/:project_name/metadata-file/status/:metadata-file-id
curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" https://services.traxretail.com/api/v4/my-project/metadata-file/status/<metadata-file-id>'
*
Mandatory fields marked indicated by
Request Details
The meta-data GET reply body will contain the following fields:
Response Details
{
"_id": "62222999992222"
"project":"dev10",
"type":"assortment",
"file_url":"http://trax-files.com/
project_name/
metadata-file/14827-kpi",
"file_name": "assortment_status_report_14827_kpi.xlsx",
"status":"done",
"creation_time": ISODate("2016-12-22T12:08:19.443 Z"),
"output":{
"output_message": "",
"errors": {},
"log_file": "http://trax-files.com/project_name/metadata-file/14827-kpi.xlsx",
"result":100,
"warnings":{}
}