Export Promotion Builder Codes
Use Promotion Jobs to export promotion codes. See Promotion Jobs for the workflow.
POST
Export Promotion Builder Codes
https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/jobs
Parameters
Path parameters
Name | Required | Type | Description |
---|---|---|---|
promotionID | Required | string | The unique identifier of the rule promotion. |
Headers
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token required to get access to the API. |
Body
Name | Required | Type | Description |
---|---|---|---|
type | Required | string | Specifies the type of the resource. The type of resource for promotions is promotion_job . |
job_type | Required | string | Specifies the job type. Possible values: code_generate, code_export. |
name | Optional | string | Represents the name of the job. The maximum allowed length is 50. |
Request Example
curl -X POST https://useast.api.elasticpath.com/v2/rule-promotions/:promotionID/jobs \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $ {
"data":{
"type": "promotion_codes",
"job_type": "code_export",
"name": "Demo export codes",
}
}
Response Example
201 Created
{
"data": {
"type": "promotion_job",
"id": "bd5708f6-d330-40a2-a6bd-b2e44bb3ce02",
"rule_promotion_id": "dd85ee8b-fddd-4ae8-9a4d-eb9404ead7bd",
"job_type": "code_export",
"name": "Demo export codes",
"status": "pending",
"meta": {
"timestamps": {
"created_at": "2024-12-04T00:03:46.388696042Z",
"updated_at": "2024-12-04T00:03:46.388696042Z"
}
}
}
}
Errors
You cannot create more than one promotion job at the same time. If you attempt to do so, the following error will be returned:
{
"errors": [
{
"status": "400",
"title": "Too many jobs",
"detail": "Only 1 pending or processing job is allowed per promotion."
}
]
}