top of page

Audit Cycle Set

API endpoint to get information about audit cycles

GET Retrieve Audit cycle Data

POST Creating and Updating audit cycles

GET

Retrieve Store Audit Cycle data

Supported Protocol: HTTPS

GET /api/:version_number/:project_name/entity/audit_cycle_sets?:pagination_params

curl -K -H "Authorization: Auth-Token YOUR_PROJECT-API-KEY" 

Request details

Mandatory fields marked indicated by*

  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. 'v5')

  project_name string *

  Project name as provided by Trax

  query_params string (key-value)

  Query Parameters by default the first page will be returned.

Response details

The Store GET reply body will contain the following fields

  pk number

  Unique identifier (pk) of the audit cycle set.

  name string

  Name of the audit cycle set.

  delete_date date-time

  Time stamp when the audit cycle set was deleted.

  audit_cycles object

  A list of audit cycles added to the given audit cycle set.

  audit_cycle_set_fk number

  Unique identifier (fk) of the audit cycle set as part of the audit_cycle object.

  start_date date

  Start date of the given audit cycle as part of the audit_cycle object.

  end_date date

  End date of the given audit cycle as part of the audit_cycle object.

  delete_date Date-time

  Time stamp when the given audit cycle was deleted.

Response

{

"metadata": {

"page": 2,

"per_page": "10",

"page_count": 1167,

"total_count": 11668,

"links": {

"self": "/api/v4/my-project/entity/audit_cycle_sets?sort=audit_cycle:name&page=1&per_page=10",

"first": "/api/v4/my-project/entity/audit_cycle_sets?}}{{sort=audit_cycle:name}}{{&page=0per_page=10",

"previous": "/api/v4/my-project/entity/audit_cycle_sets?}}{{sort=audit_cycle:name}}{{&page=0&per_page=10",

"next": "/api/v4/my-project/entity/audit_cycle_sets?}}{{sort=audit_cycle:name}}{{&page=2&per_page=10",

"last": "/api/v4/my-project/entity/store_audit_cycle?}}{{sort=audit_cycle:name}}{{&page=1166&per_page=10",

},

"audit_cycle_sets": [

{

"pk": "6123",

"name": "Daily",

"delete_date":"",

"audit_cycles": [

{

"pk":"123",

"audit_cycle_set_fk": 1,

"start_date":"2021-12-01",

"end_date":"2021-12-31",

"delete_date":"2022-01-01"

},

{

"pk":"432",

"audit_cycle_set_fk": 1,

"start_date":"2022-01-01",

"end_date":"2022-02-01",

"delete_date":"null"

}

]

}

]}

}

  

Validation and Errors

The following are the validations and errors that may appear due to an invalid GET request

  Unknown Field 

  • Error Code: 400 - Bad Request

  • Error: Unknown Field: <field_name>

  Internal Server Error

  • Error Code: 500 - Internal Server 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>

 

                   

POST

Supported protocol: HTTPS

Creating and Updating audit cycle sets in Trax is done asynchronously. The stores POST should be done via the async jobs framework using the information below:

POST <host>/api/v4/<project>/async-job

Ex. https://services.traxretail.com/api/v4/myproject/async-job

Aim: To enable Clients to upload a file containing product data to Trax.

 

 

Request Details

Mandatory fields marked indicated by*

  Request Headers

  Authorization string*

  Value: 'Auth-Token {project auth token}'

  Authentication token provided by Trax

  Request Body

  File - xlsx file*

  Entity_type - audit_cycle_set*

  Import_mode - “add” or “replace”*

  File_format - XLSX*

  Action - “upload”

  Force_version - “new”

 

Response

  job_id

Validation and Errors

The following are the validations and errors that may appear due to an invalid POST request

  Unknown Field 

  • Error Code: 400 - Bad Request

  • Error: Unknown Field: <field_name>

  Internal Server Error

  • Error Code: 500 - Internal Server 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>

  Missing entity

  • Error Code: "missing file"

  • Error: A file hasn't been added or not correct

  • Error Code: "missing attribute-entity_type"

  • Error: Entity_type hasn't been filled out

  • Error Code: "missing attribute-file_format"

  • Error: File_format hasn't been filled out

Audit Cycle Use Cases

1. Add audit cycles to the project. In this case, you will add new cycle(s) and the previously uploaded remains there.

  • Add for the Import_mode field the value Add

  • Upload the file for the File field as .xlsx

  • Fill out the rest of the mandatory field as well (File_Format and Entity_type)

2. Replace audit cycles to the project. In this case, you will overwrite the previously uploaded cycles.

  • Add for the Import_mode field the value Replace

  • Upload the file for the File field as .xlsx

  • Fill out the rest of the mandatory field as well (File_Format and Entity_type)

bottom of page