Create a Rule Promotion Job
POSThttps://useast.api.elasticpath.com/v2/rule-promotions/:uuid/jobs
Creates an asynchronous job for a specific Rule Promotion. Jobs are used to generate or export promotion codes in bulk.
The following job types are supported:
code_generate
: Generates a batch of unique promotion codes.code_export
: Exports all existing promotion codes as a downloadable CSV file.
Job processing occurs asynchronously. The job request is queued, and its status must be checked separately.
Job Processing Status
Jobs can have the following statuses:
pending
: Job is in the queue, waiting to be processed.processing
: Job is actively being processed.completed
: Job completed successfully.failed
: Job encountered an error and did not complete.cancelling
: Cancellation in progress (for long-running jobs).cancelled
: Job was successfully cancelled.
Please refer to the OpenAPI examples section on this page for sample job creation requests.
Request
Responses
- 201
- 400
Promotion job created
Bad Request
- 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");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"type\": \"promotion_job\",\n \"job_type\": \"code_generate\",\n \"name\": \"string\",\n \"parameters\": {\n \"number_of_codes\": 0,\n \"max_uses_per_code\": 0,\n \"consume_unit\": \"per_application\",\n \"code_prefix\": \"string\",\n \"code_length\": 8\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear