Promotions
Creates many promotions in a single request, all sharing the configuration in promotion.
Supply the codes explicitly via codes, OR ask the server to generate them via generate
(exactly one of the two is required). Up to 1000 codes may be created per request.
The response reports partial success: every requested code appears either in created
or in failed with a reason (e.g. already taken, duplicate in request). A 201 is
returned when all codes were created, 207 when some failed.
Authorizations
AuthorizationstringRequired
Body
codesstring[]Optional
Explicit list of codes to create (mutually exclusive with generate)
Responses
201
all codes created
application/json
207
some codes created, some failed
application/json
422
shared configuration invalid, or code source missing/ambiguous
application/json
post/api/v1/promotions/bulk
POST /api/v1/promotions/bulk HTTP/1.1
Host: catalog.example.edu
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 361
{
"promotion": {
"account_id": 1,
"listing_id": 1,
"name": "text",
"description": "text",
"amount": 1,
"discount_type": "flat",
"usage_type": "once-per-user",
"active": true,
"start_date": "text",
"end_date": "text",
"max_per_user": 1,
"max_total_use": 1,
"enable_for_multi_seat_purchases": true
},
"codes": [
"text"
],
"generate": {
"count": 1,
"prefix": "text",
"length": 1,
"charset": "alphanumeric"
}
}{
"summary": {
"requested": 1,
"created": 1,
"failed": 1
},
"created": [
{
"id": 1,
"listing_id": 1,
"code": "text",
"name": "text",
"description": "text",
"amount": "text",
"discount_type": "flat",
"usage_type": "once-per-user",
"active": true,
"start_date": "text",
"end_date": "text",
"max_per_user": 1,
"max_total_use": 1,
"status": "text",
"created_at": "text"
}
],
"failed": [
{
"code": "text",
"errors": [
"text"
]
}
]
}Last updated
Was this helpful?