Skip to main content

Get Promotion Jobs

GET 

https://useast.api.elasticpath.com/v2/promotions/:promotionID/jobs

Retrieves the list of jobs for a specific promotion.

In the response example, you can see the result.generated field, which indicates the number of codes generated during the job processing. Additionally, you may also see the optional result.deleted field, indicating the number of codes deleted during the job cancellation. The parameters and result objects are shown only when job_type is code_generate.

Filtering

The following operators and attributes are available when filtering on this endpoint.

AttributeTypeOperatorExample
job_typestringeqeq(job_type, code_export)
statusstringeqeq(status, complete)

Errors

If an error occurs during job processing, the response includes an optional error field. For example, when you GET promotion jobs, the following response shows the details within the error field if an error occurred during job processing.

\{
"data": [
\{
"type": "promotion_job",
"id": "84d86114-a92d-4c34-92f1-3e36ef6cabeb",
"promotion_id": "ad386702-e780-42c6-b190-0527ad768917",
"job_type": "code_generate",
"name": "job",
"parameters": \{
"number_of_codes": 1000,
"consume_unit": "per_cart",
"max_uses_per_code": 1,
"code_length": 8,
"code_prefix": "promo-"
\},
"status": "failed",
"error": "codes limit exceeded",
"meta": \{
"timestamps": \{
"created_at": "2023-12-06T13:52:29.587Z",
"updated_at": "2023-12-06T13:54:49.133Z"
\}
\}
\}
],
"links": \{
"current": "https://useast.api.elasticpath.com/v2/promotions/ad386702-e780-42c6-b190-0527ad768917/jobs?page[offset]=0&page[limit]=25",
"first": "https://useast.api.elasticpath.com/v2/promotions/ad386702-e780-42c6-b190-0527ad768917/jobs?page[offset]=0&page[limit]=25",
"last": "https://useast.api.elasticpath.com/v2/promotions/ad386702-e780-42c6-b190-0527ad768917/jobs?page[offset]=0&page[limit]=25",
"prev": "https://useast.api.elasticpath.com/v2/promotions/ad386702-e780-42c6-b190-0527ad768917/jobs?page[offset]=0&page[limit]=25",
"next": "https://useast.api.elasticpath.com/v2/promotions/ad386702-e780-42c6-b190-0527ad768917/jobs?page[offset]=0&page[limit]=25"
\},
"meta": \{
"page": \{
"limit": 25,
"offset": 0,
"current": 1,
"total": 1
\},
"results": \{
"total": 1
\}
\}
\}

Request

Path Parameters

    promotionID stringrequired

    The unique identifier of a promotion.

Query Parameters

    filter string

    Specifies the filter attributes.

Header Parameters

    Authorization Bearerrequired

    The Bearer token required to get access to the API.

Responses

Successful response

Schema
    data object[]
  • Array [
  • idstring

    A unique ID generated when a job is created.

    typestring

    Always promotion_job.

    Example: promotion_job
    promotion_idstring

    A unique ID of a promotion.

    job_typestring

    The type of job you want to run. For example, code_generate to generate codes or code_export to export codes.

    namestring

    The name of the job. The maximum length allowed is 50 characters.

    parametersobject
    statusstring

    The status of the job. See Overview.

    meta object
    timestamps object
    created_atdate-time

    The creation date of the job.

    updated_atdate-time

    The last updated date of the job.

  • ]

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://useast.api.elasticpath.com/v2/promotions/:promotionID/jobs");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://useast.api.elasticpath.com
Auth
Parameters
— pathrequired
— headerrequired
— query
ResponseClear

Click the Send API Request button above and see the response here!