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.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
batchIntegerID of voucher batch to get vouchers for. 0 for all batches in customer.No0
customerIntegerID of customer to get vouchers for. Only used if batch=0.NoCustomer of authentication user.
sortStringField to sort by. "created", "serial", "status", or "value".No"serial"
descendingInteger1 to sort descending, 0 not to.No0

Responses

CodeDescription
200Success.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your role does not allow this.
404The 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

VersionChanges
3.13Function added.