Skip to main content

Tasks

Retrieve All Tasks

The tasks API allows customers using Krestor's ingestion service to request the status of asynchronous jobs, such as catalog uploads and user data requests made for compliance reasons.

The tasks endpoint is most commonly used to check on the status of files uploaded for ingestion to the FTP and catalog HTTP endpoints, to request ingestion jobs in progress, queued, succeeded and failed.

Additionally, if the task is an ingestion task and the status of the task is DONE, a result field is added to the response that contains the changes the task made, and a boolean value that indicates if the changes have been indexed.

curl -X GET -H "Content-Type: application/json" \
-u"[your token]:" "https://ac.cnstrc.com/v1/tasks?key=[your API key]&page=[page number]&num_results_per_page=[number of tasks per page]"

HTTP Request

GET https://ac.cnstrc.com/v1/tasks?key=[your API key]&page=[page number]&num_results_per_page=[number of tasks per page]

Response format

{
"total_count": 1,
"tasks": [
{
"id": 0,
"type": "ingestion",
"status": "QUEUED",
"submission_time": "2020-04-24T15:06:27Z",
"last_update": null,
"filename": "somefile.csv"
}
],
"status_counts": {
"QUEUED": 1,
"DONE": 0,
"IN_PROGRESS": 0,
"FAILED": 0
}
}

Query Parameters

ParameterRequired?Description
keyYesThe key of the index you'd like to to retrieve tasks for.
pageNoThe page number of the results. Defaults to 1. Can't be used together with 'offset'
offsetNoThe number of results to skip from the beginning. Can't be used together with 'page'
num_results_per_pageNoThe number of tasks per page to return. Defaults to 20. The maximum value is 100.

Retrieve By Specific Task ID

curl -X GET -H "Content-Type: application/json" \
-u"[your token]:" "https://ac.cnstrc.com/v1/task/0?key=[your API key]"

HTTP Request

GET https://ac.cnstrc.com/v1/task/[task_id]?key=[your API key]

Response format

{
"id": 0,
"status": "QUEUED",
"submission_time": "2020-04-24T15:06:27Z",
"last_update": null,
"start_time": null",
}

Response format for Completed Task:

{
"id": 0,
"status": "DONE",
"submission_time": "2020-04-24T15:06:27Z",
"last_update": "2020-04-24T15:08:27Z",
"start_time": "2020-04-24T15:07:27Z",
"result": {
"changelog": {
"sections": {
"Products": {
"items_updated": 10,
"items_deleted": 0,
"variations_updated": 20,
"variations_deleted": 5
}
},
"index_built": true
}
}
}

Response fields

ParameterDescription
idThe id of the task.
statusCurrent status of the task (QUEUED, DONE, FAILED, IN_PROGRESS).
submission_timeTime of task submission.
last_updateLast time the status of this task was updated. (May be null if the task has never been run before).
start_timeStarting time of the task. (May be null if the task has not been run yet).
typeThe type of the task. References the job that is done by the task. Possible values: ingestion, user_data_request
filenameOnly for type="ingestion". The name of the file uploaded to Krestor.
protocolOnly for type="ingestion". Describes if the ingestion was created via FTP ("ftp"), API ("http") or other source (null).
resultContains changelog that shows changes made by that task, and a boolean index_built that shows if changes from that task have been indexed.

URL Parameters

ParameterDescription
task_idThe id of the task you would like to retrieve information about.

Query Parameters

ParameterRequired?Description
keyYesThe index you'd like to to retrieve tasks for.

Task types

  • ingestion - data uploading to Krestor via HTTP or FTP
  • user_data_request - CCPA requests