This article presents possible sample flows that you can support. This can be a helpful jumping-off point as you plan your implementation.
Note: Learn more about querying data collections using API Query Language.
On a data collection that has the Publish plugin, create a task to publish all special-edition holiday items at the specified time:
Call Create Task and specify the following parameters:
{
"task": {
"type": "UPDATE_PUBLISH_STATUS",
"updatePublishStatusOptions": {
"dataCollectionId": "products",
"filter": {
"holidays": {
"$in": ["Halloween"]
}
},
"operation": "SCHEDULE_PUBLISHED_STATUS",
"schedulePublishedStatusOptions": {
"date": "2024-10-24T10:00:00Z"
}
}
}
}
The method returns the following response:
{
"task": {
"id": "b8815393-3bca-4de7-b592-53eeb1465a61",
"type": "UPDATE_PUBLISH_STATUS",
"status": "NEW",
"startedAt": "2024-09-05T10:34:59.507Z",
"estimatedItemCount": 5,
"itemsSucceeded": 0,
"itemsFailed": 0,
"failures": [],
"updatePublishStatusOptions": {
"dataCollectionId": "Products",
"filter": {
"holidays": {
"$in": ["Halloween"]
}
},
"operation": "SCHEDULE_PUBLISHED_STATUS",
"schedulePublishedStatusOptions": {
"date": "2024-10-24T10:00:00Z"
}
}
}
}
At any point, you can check the task status by calling the Get Task method with the task ID.
The method returns a response such as:
{
"task": {
"id": "b8815393-3bca-4de7-b592-53eeb1465a61",
"type": "SCHEDULE_PUBLISHED_STATUS",
"status": "FAILED",
"startedAt": "2024-09-05T10:34:59.507Z",
"finishedAt": "2024-09-05T10:35:03.654Z",
"estimatedItemCount": 4,
"itemsSucceeded": 0,
"itemsFailed": 4,
"failures": [
{
"code": 404,
"description": "Collection not found.",
"data": {
"dataCollectionId": "Products"
}
}
],
"updatePublishStatusOptions": {
"dataCollectionId": "Products",
"filter": {
"holidays": {
"$in": ["Halloween"]
}
},
"operation": "SCHEDULE_PUBLISHED_STATUS",
"schedulePublishedStatusOptions": {
"date": "2024-10-24T10:00:00Z"
}
}
}
}
Create a task to retrieve and delete all products from a specified manufacturer:
Call Create Task and specify the following parameters:
{
"task": {
"type": "DELETE_BY_QUERY",
"deleteByQueryOptions": {
"dataCollectionId": "Products",
"filter": {
"manufacturer": "BadAcme"
}
}
}
}
The method might return the following response:
{
"task": {
"id": "097a5564-0fec-4425-8d1e-3e753b48a422",
"type": "DELETE_BY_QUERY",
"status": "NEW",
"startedAt": "2024-09-05T10:34:59.507Z",
"estimatedItemCount": 3,
"itemsSucceeded": 0,
"itemsFailed": 0,
"failures": [],
"deleteByQueryOptions": {
"dataCollectionId": "Products",
"filter": {
"manufacturer": "BadAcme"
}
}
}
}
At any point, you can check the task status by calling the Get Task method with the task ID.
The method returns a response such as:
{
"task": {
"id": "097a5564-0fec-4425-8d1e-3e753b48a422",
"type": "DELETE_BY_QUERY",
"status": "COMPLETED",
"startedAt": "2024-09-05T10:34:59.507Z",
"finishedAt": "2024-09-05T10:35:03.654Z",
"estimatedItemCount": 3,
"itemsSucceeded": 3,
"itemsFailed": 0,
"failures": [],
"deleteByQueryOptions": {
"dataCollectionId": "Products",
"filter": {
"manufacturer": "BadAcme"
}
}
}
}