Import promo codes
Description
Imports one or multiple promo codes into a loyalty program.
Request URL
Method: POST
https://example.com/api/v1.1/promocodes/import
Request example
Parameter | Type | Example | Required | Description |
---|---|---|---|---|
token | string | "abcdefghijklmnqrstuvwxyz" | Yes | API token |
format | string | "json" | No | Response data format. By default – json |
codes | JSON array | ["CODE-1", "CODE-2"] | Yes | Promo codes list |
loyalty_id | int | 1 | Yes | Loyalty program ID |
Request example
- JSON
- XML
{
"token": "abcdefghijklmnqrstuvwxyz",
"codes": [
"CODE-1",
"CODE-2"
],
"loyalty_id": 1
}
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<codes>CODE-1</codes>
<codes>CODE-2</codes>
<loyalty_id>6</loyalty_id>
</xml>
Response example
- JSON
- XML
{
"data": [
{
"code": "CODE-1",
"error": 0,
"error_text": ""
},
{
"code": "CODE-2",
"error": 0,
"error_text": ""
}
],
"discarded_by_limit": 0,
"duplicated": 0,
"error": 0,
"error_text": "Successful operation",
"inserted": 2
}
<xml>
<data>
<code>CODE-1</code>
<error>0</error>
<error_text/>
</data>
<data>
<code>CODE-2</code>
<error>0</error>
<error_text/>
</data>
<discarded_by_limit>0</discarded_by_limit>
<duplicated>0</duplicated>
<error>0</error>
<error_text>Successful operation</error_text>
<inserted>2</inserted>
</xml>
Response parameters
Parameter | Type | Description |
---|---|---|
error | int | Error code |
error_text | string | Error text |
code | string | Promo code |
discarded_by_limit | int | Import error due to loyalty program limitations |
duplicated | int | Import error due to duplication |
inserted | int | Number of successfully imported promo codes |