Skip to main content

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

NameRequiredTypeDescription
promotionIDRequiredstringThe unique identifier of the rule promotion.

Headers

NameRequiredTypeDescription
AuthorizationRequiredstringThe Bearer token required to get access to the API.

Body

NameRequiredTypeDescription
typeRequiredstringSpecifies the type of the resource. The type of resource for promotions is promotion_job.
job_typeRequiredstringSpecifies the job type. Possible values: code_generate, code_export.
nameOptionalstringRepresents 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."
}
]
}