Cancel a Job
POSThttps://euwest.api.elasticpath.com/pcm/jobs/:jobID/cancel
The jobs endpoints display the status of a number of endpoints that function as jobs, for example, product import and export, and duplicating hierarchies.
Jobs are processed one at a time. You can continue to send job requests, but those jobs are queued. In other words, Commerce looks for any jobs that have a status of PENDING and starts the job with the earliest created date. If you decide that a specific job needs to be prioritized over another, you can cancel the less critical job using the Cancel a job
endpoint. You can only cancel jobs whose status is PENDING.
Request
Path Parameters
A unique identifier for the job.
- application/json
Body
Responses
- 200
- 400
- 404
- 422
- 500
Successfully cancelled job
- application/json
- Schema
- Example (auto)
- cancelled
Schema
data objectrequired
{
"data": {
"id": "string",
"type": "pim-job",
"attributes": {
"started_at": "2020-09-22T09:00:00",
"completed_at": "2020-09-22T09:00:00",
"created_at": "2020-09-22T09:00:00",
"updated_at": "2020-09-22T09:00:00",
"type": "child-products",
"status": "pending"
},
"meta": {
"x_request_id": "string",
"copied_from": "string",
"hierarchy_id": "string",
"file_locations": [
"string"
],
"filter": "string"
}
}
}
Cancelled Job
{
"data": {
"type": "pim-job",
"id": "1e5da4bf-b2c0-4619-bb3d-f749875b15bb",
"attributes": {
"started_at": null,
"completed_at": null,
"created_at": "2023-11-14T15:37:13.589Z",
"status": "cancelled",
"type": "product-import",
"updated_at": "2023-11-14T15:37:13.589Z"
},
"meta": {
"x_request_id": "4fde01c1-95ba-4dd6-948e-b9d5763ff9c2"
}
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (auto)
- bad-request
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Bad Request",
"detail": "Could not parse the supplied filter",
"status": "400"
}
]
}
Bad Request. Not Found.
- application/json
- Schema
- Example (auto)
- internal-server-error
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Not Found",
"status": "404"
}
]
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (auto)
- failed-validation
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"title": "Failed Validation",
"status": "422",
"detail": "<XYZ> can not be empty"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (auto)
- internal-server-error
Schema
errors undefined[]required
{
"errors": [
{
"status": "500",
"title": "Internal server error",
"detail": "An internal error has occurred.",
"request_id": "00000000-0000-0000-0000-000000000000",
"meta": {
"missing_ids": [
"e7d50bd5-1833-43c0-9848-f9d325b08be8"
]
}
}
]
}
{
"errors": [
{
"status": "500",
"title": "Internal Server Error",
"detail": "There was an internal server error, you can report with your request id.",
"request_id": "635da56d-75a1-43cd-b696-7ab119756b3a"
}
]
}
Authorization: http
name: bearerAuthtype: httpscheme: bearer
- 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://euwest.api.elasticpath.com/pcm/jobs/:jobID/cancel");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());