JSON API » customers » customers/list

Gets the fields of all customers.

Input parameters

Requires authentication and the callshop or commerce role privileges.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
deletedInteger1 to only return deleted customers, 0 to only return non-deleted customers, -1 to return customers irrespective of their deleted status.Recommended0
bill_typeStringOnly return customers with this billing type ("callshop", "external", "none", "postpaid", "prepaid", "prepaid_calls", or "prepaid_invoices"). Empty string for any.NoEmpty string.
countInteger1 to return a count, 0 to return full data.No0
descendingInteger1 to sort descending, 0 not to.No0
directoryInteger1 to only return customers with directory enabled, 0 to only return customers with directory disabled, -1 to return all customers.No-1
limitIntegerThe maximum results to return. 0 for all.No0
nameStringOnly return customers whose name contains this string.NoEmpty string.
offsetIntegerThe result to start at. 0 for the first.No0
pagesInteger1 to return a reduced set of data for generating the pages select box, 0 to return full data.No0
parentIntegerID of parent customer.NoCustomer of authentication user.
recursiveInteger1 to return sub-customers recursively, 0 not to. Has no effect if count or pages is specified.No0
sortStringField to sort by. "account", "description", or "name".No"name"

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.

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

VersionChanges
3.15Default value of the directory parameter changed to -1.
3.14Added option -1 for the value of the deleted parameter.
3.13Function added.