Description
Use this API method to upload a list of coupon codes. In this API implementation, the coupon codes are included directly within the XML message that is POSTed to the Mapp platform.
Future API methods will include the ability to upload coupon codes that are stored in a separate text file.
Arguments
Field | Description | Field Type | Required | Example |
---|---|---|---|---|
bank_id | The ID number of the coupon bank that you want to insert the coupon codes into. | Number | Yes | 4 |
coupon_codes | A carriage return delimited list of coupon codes to be added into the specified coupon bank | Number | Yes | M746209500 M648626568 M485275161 |
Response
Field | Description | Example |
---|---|---|
inserted | The number of coupon codes included in the <coupon_codes> element that were successfully uploaded into the specified coupon bank | 17842 |
failed | The number of coupon codes included in the <coupon_codes> element that failed to be uploaded into the specified coupon bank. This error will typically be returned when a coupon code exceeds the 40-character maximum limit. This count will also include any general database insert errors for any given coupon code. | 197 |
duplicates | The number of coupon codes included in the <coupon_codes> element that were not inserted because the code already exists in the specified coupon bank. | 1961 |
total | The total number of coupon codes included in the <coupon_codes> element of the XML message submitted. | 20000 |
Response Codes
Response Code | Response Text | Description |
---|---|---|
666 | Coupon codes successfully imported | Successful operation |
667 | Action not taken, invalid bank id | Invalid bank_id passed |
668 | Action not taken, no valid/unique coupon codes to import | No valid coupon codes were present in the <coupon_codes> element. |
Example Post
<methodCall>
<methodName>coupon.addcoupons</methodName>
<bank_id>4</bank_id>
<coupon_codes>
M746209500
M648626568
M485275161
</coupon_codes>
</methodCall>
Example Response
<methodResponse>
<item>
<methodName>coupon.addcoupons</methodName>
<responseCode>666</responseCode>
<responseText>Coupon codes successfully imported</responseText>
<inserted>17842</inserted>
<failed>197</failed>
<duplicates>1961</duplicates>
<total>20000</total>
<responseNum>1</responseNum>
</item>
</methodResponse>
Example Error
<methodResponse>
<item>
<methodName>coupon.addcoupons</methodName>
<responseCode>667</responseCode>
<responseText>Action not taken, invalid bank id</responseText>
<responseData></responseData>
<responseNum>1</responseNum>
</item>
</methodResponse>