Cancel a Rule Promotion Job
POSThttps://useast.api.elasticpath.com/v2/rule-promotions/:uuid/jobs/:job-uuid/cancel
Cancels an asynchronous job for a rule promotion if its status is pending
or processing
.
- Only jobs that have not yet completed can be canceled.
- Once canceled, no further processing occurs, and partially completed results may be deleted.
Request
Path Parameters
uuid stringrequired
The unique identifier of the rule promotion.
job-uuid stringrequired
The unique identifier of the job to be canceled.
Responses
- 200
- 422
Successfully Canceled the Rule Promotion Job
- application/json
- Schema
- PromotionJobCancellingResponse
Schema
Successful Cancellation Request for a Rule Promotion Job
{
"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"
}
}
}
}
Unprocessable Entity
- application/json
- Schema
- Example (auto)
- CannotCancelCompletedJobError
Schema
errors object[]
{
"errors": [
{
"status": "422",
"title": "Unprocessable Entity",
"detail": "Only pending or processing jobs can be cancelled."
}
]
}
Error When Attempting to Cancel a Job That Is Not Pending or Processing
{
"errors": [
{
"status": "422",
"title": "Unprocessable Entity",
"detail": "Only pending or processing jobs can be cancelled."
}
]
}
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/rule-promotions/:uuid/jobs/:job-uuid/cancel");
request.Headers.Add("Accept", "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear