JSON API » vouchers » vouchers/list
Gets the fields of all vouchers in a given batch or customer.
Input parameters
Requires authentication and the commerce role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
batch | Integer | ID of voucher batch to get vouchers for. 0 for all batches in customer. | No | 0 |
customer | Integer | ID of customer to get vouchers for. Only used if batch=0. | No | Customer of authentication user. |
sort | String | Field to sort by. "created", "serial", "status", or "value". | No | "serial" |
descending | Integer | 1 to sort descending, 0 not to. | No | 0 |
Responses
Code | Description |
---|---|
200 | Success. |
400 | Invalid input parameters specified. Check the key and message fields for more details. |
401 | The authentication details provided are invalid. |
402 | Your role does not allow this. |
404 | The voucher batch specified does not exist, or you do not have permission to view it. |
Data returned
An array of fields, corresponding to the rows of the vouchers table in the database.
Example: With batch
http://enswitch.example.com/api/json/vouchers/list/?auth_username=user;auth_password=password;batch=123{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "voucher":"1234567890", ... }, { "voucher":"2345678901", ... } ] }
Change history
Version | Changes |
---|---|
3.13 | Function added. |