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.
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
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]"
// Node
// Please refer to https://Krestor-io.github.io/Krestorio-node/module-tasks.html#~getAllTasks
# Please refer to https://Krestor-io.github.io/Krestorio-python/Krestor_io.modules.html#module-Krestor_io.modules.tasks
// Please refer to https://Krestor-io.github.io/Krestorio-java/io/Krestor/client/KrestorIO.html
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
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
Parameter | Required? | Description |
---|---|---|
key | Yes | The key of the index you'd like to to retrieve tasks for. |
page | No | The page number of the results. Defaults to 1. Can't be used together with 'offset' |
offset | No | The number of results to skip from the beginning. Can't be used together with 'page' |
num_results_per_page | No | The number of tasks per page to return. Defaults to 20. The maximum value is 100. |
Retrieve By Specific Task ID
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
curl -X GET -H "Content-Type: application/json" \
-u"[your token]:" "https://ac.cnstrc.com/v1/task/0?key=[your API key]"
// Node
// Please refer to https://Krestor-io.github.io/Krestorio-node/module-tasks.html#~getTask
# Please refer to https://Krestor-io.github.io/Krestorio-python/Krestor_io.modules.html#module-Krestor_io.modules.tasks
// Please refer to https://Krestor-io.github.io/Krestorio-java/io/Krestor/client/KrestorIO.html
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
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
Parameter | Description |
---|---|
id | The id of the task. |
status | Current status of the task (QUEUED, DONE, FAILED, IN_PROGRESS). |
submission_time | Time of task submission. |
last_update | Last time the status of this task was updated. (May be null if the task has never been run before). |
start_time | Starting time of the task. (May be null if the task has not been run yet). |
type | The type of the task. References the job that is done by the task. Possible values: ingestion , user_data_request |
filename | Only for type="ingestion". The name of the file uploaded to Krestor. |
protocol | Only for type="ingestion". Describes if the ingestion was created via FTP ("ftp" ), API ("http" ) or other source (null ). |
result | Contains 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
Parameter | Description |
---|---|
task_id | The id of the task you would like to retrieve information about. |
Query Parameters
Parameter | Required? | Description |
---|---|---|
key | Yes | The index you'd like to to retrieve tasks for. |
Task types
ingestion
- data uploading to Krestor via HTTP or FTPuser_data_request
- CCPA requests