Skip to main content

Cancel Promotion Builder Job

Cancels an asynchronous job whose status is pending or processing. See Promotion Jobs for the workflow.

POST Cancel Promotion Builder Job

https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/jobs/:jobID/cancel

Parameters

Path parameters

NameRequiredTypeDescription
promotionIDRequiredstringThe unique identifier of the rule promotion.
jobIDRequiredstringThe unique identifier of the rule promotion job.

Headers

NameRequiredTypeDescription
AuthorizationRequiredstringThe Bearer token required to get access to the API.

Body

Empty body.

Request Example

curl -X POST https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/jobs/:jobID/cancel \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $ {}
}

Response Example

200 OK

{
"data": {
"type": "promotion_job",
"id": "9bc1391c-1b65-419e-940e-66ed86c07001",
"rule_promotion_id": "8c150382-b258-4c88-a2d4-b9ea0be74a07",
"job_type": "code_generate",
"name": "Demo bulk code generate",
"parameters": {
"number_of_codes": 100,
"max_uses_per_code": 1,
"consume_unit": "per_checkout",
"code_prefix":"summer-",
"code_length": 8
},
"status": "cancelling",
"meta": {
"timestamps": {
"created_at": "2024-12-03T23:31:40.962680423Z",
"updated_at": "2024-12-03T23:31:40.962680423Z"
}
}
}
}

Errors

You cannot cancel completed job. If you attempt to do so, the following error will be returned:

{
"errors": [
{
"status": "422",
"title": "Unprocessable Entity",
"detail": "Only pending or processing jobs can be cancelled"
}
]
}