JSON API » invoices » invoices/list
Gets the fields of invoices.
Input parameters
Requires authentication and the callshop or reports role privileges.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
start | Integer | Start Unix timestamp. | Recommended | 0 |
end | Integer | End Unix timestamp. | Recommended | Now. |
customer | String or integer | Customer to get invoices for. See below for more details. | Recommended | Customer of authentication user. |
status | String | Only return invoices with this status. "approved", "both" (which means "approved" plus "queued"), "cancelled", "due", "overdue", "paid", "payment_refused", "pending", "prepaid", "queued", "superceded", or empty string for all. | No | Empty string. |
sort | String | Field to sort by. "created", "customer_name", "id", "number", or "status". | No | "id" |
descending | Integer | 1 to sort descending, 0 not to. | No | 0 |
Failure to specify the start and end may put a heavy load on the database.
The customer field may have the following values:
Field value | Returns calls for |
---|---|
Field not set | Customer of authentication user. |
ID of a customer | That customer. |
"all" | All customers under customer of authentication user. |
"system" | All customers on system. |
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. |
403 | Your rate plan does not allow this. |
Data returned
An array of fields, corresponding to the rows of the invoices table in the database.
Example: With required and recommended parameters
http://enswitch.example.com/api/json/invoices/list/?auth_username=user;auth_password=password;start=1230000000;end=1240000000;customer=123{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "id":123, "number":1, ... }, { "id":124, "number":2, ... } ] }
Change history
Version | Changes |
---|---|
3.13 | Function added. |