Create a Promotion Job
POSThttps://useast.api.elasticpath.com/v2/promotions/:promotionID/jobs
Use this endpoint to create an asynchronous job to generate codes and export promotion codes.
Request
Responses
- 201
Promotion job created
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://useast.api.elasticpath.com/v2/promotions/:promotionID/jobs");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
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_item\",\n \"code_prefix\": \"string\",\n \"code_length\": 0\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
ResponseClear