JSON API » customers » customers/list
Gets the fields of all customers.
Input parameters
Requires authentication and the callshop or commerce role privileges.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
deleted | Integer | 1 to only return deleted customers, 0 to only return non-deleted customers, -1 to return customers irrespective of their deleted status. | Recommended | 0 |
bill_type | String | Only return customers with this billing type ("callshop", "external", "none", "postpaid", "prepaid", "prepaid_calls", or "prepaid_invoices"). Empty string for any. | No | Empty string. |
count | Integer | 1 to return a count, 0 to return full data. | No | 0 |
descending | Integer | 1 to sort descending, 0 not to. | No | 0 |
directory | Integer | 1 to only return customers with directory enabled, 0 to only return customers with directory disabled, -1 to return customers irrespective of their directory status. | No | 0 |
limit | Integer | The maximum results to return. 0 for all. | No | 0 |
name | String | Only return customers whose name contains this string. | No | Empty string. |
offset | Integer | The result to start at. 0 for the first. | No | 0 |
pages | Integer | 1 to return a reduced set of data for generating the pages select box, 0 to return full data. | No | 0 |
parent | Integer | ID of parent customer. | No | Customer of authentication user. |
recursive | Integer | 1 to return sub-customers recursively, 0 not to. Has no effect if count or pages is specified. | No | 0 |
sort | String | Field to sort by. "account", "description", or "name". | No | "name" |
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. |
Data returned
An array of fields, corresponding to the rows of the customers table in the database.
Example: With required and recommended parameters
http://enswitch.example.com/api/json/customers/list/?auth_username=user;auth_password=password;deleted=0{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":[ { "id":1, "name":"example1", ... }, { "id":2, "name":"example2", ... }, ] }
Change history
Version | Changes |
---|---|
3.14 | Added option -1 for the value of the deleted parameter. |
3.13 | Function added. |