Skip to main content

Create a Rule Promotion Job

POST 

https://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

Promotion job created

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());
Request Collapse all
Base URL
https://useast.api.elasticpath.com
Parameters
— pathrequired
Body required
{
  "type": "promotion_job",
  "job_type": "code_generate",
  "name": "string",
  "parameters": {
    "number_of_codes": 0,
    "max_uses_per_code": 0,
    "consume_unit": "per_application",
    "code_prefix": "string",
    "code_length": 8
  }
}
ResponseClear

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

We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.