Query all the Customers

Query the information of all the customers.

Request URL

GET {base_url}/dm/open_api/v1/customers

Request parameters

Headers
Parameter Required Type Description
Authorization Yes String Pass the access token in the header.

Format: Bearer {access_token}.

Query parameters
Parameter Required Type Description
pageSize No Integer Define how many records per page.
  • Default value: 10
  • Maximum value: 50
pageNumber No Integer Define which page is displayed.
  • Default value: 1
sort No String

Define the sorting field.

You can enter the response parameters in this sorting field to sort the response result.

Examples:

  • customerId: Sort the records by customer ID in ascending order.
  • -customerId: Sort the records by customer ID in descending order.

Response parameters

Parameter Type Description
data Object <Details> The detailed information.
requestId String The unique ID of the request, which can be used to quickly locate the request.
status String Request result:
  • Success
  • Failed
time Long The response time.
Note: The YCM API response returns a timestamp, you can convert the timestamp to detailed date and time as needed. For more information, see Convert Timestamp to Local Date and Time.
Details
Parameter Type Description
pageSize Integer How many records are displayed per page.
pageNumber Integer Which page is displayed.
total Integer The total number of customers.
list Array <Customer_Info> The information list of the customer.
Customer_Info
Parameter Type Description
customerId Long The ID of the customer.
firstName String First name.
lastName String Last name.
company String Company name.
email String Email address.
businessNumber String Business number.
mobileNumber String Mobile number.
homeNumber String Home number.
faxNumber String Fax number.
zipCode String ZIP code.
street String Street.
city String City.
state String State.
country String Country.
remark String Remark.

Example

Request example

Query all the customers:
  • Display 3 records per page.
  • Display Page 1.
  • Display the customers by ID in ascending order.
GET /dm/open_api/v1/customers?pageSize=3&pageNumber=1&sort=customerId HTTP/1.1
Host: ycm.yeastar.com
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21Kd3RQYXlsb2FkSW5mbyI6eyJncmFudFR5cGUiOiJjbGllbnRfY3JlZGVudGlhbHMiLCJ5c0lkIjoxNzg5NjM2MDM5MDg1MDI1NjY0NSwicmVmcmVzaFZlcnNpb24iOjE2MzkwMTIwODh9LCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjM5MDEzODg4LCJhdXRob3JpdGllcyI6WyJST0xFX0NMSUVOVCJdLCJqdGkiOiI3MGI3N2NiOC03MzZjLTQxODctYjM2Yy0xNjM0MzNlZWJjNWEiLCJjbGllbnRfaWQiOiJ5QXN4ZzdITkRFczNxSHprQk1aUU5Pblo2NTBPRUNNWSJ9._I0umqPvrMKnL1tlkragMjkuGWcYg1SAoTimfyKl7i8
Response example
HTTP/1.1 200 OK
{
  "data": {
    "pageSize": 3,
    "pageNumber": 1,
    "total": 30,
    "list": [
      {
        "customerId": 50086120,
        "firstName": "Leo",
        "lastName": "Ball",
        "company": "Example company",
        "email": "leo@example.com",
        "businessNumber": "136160XXXXX",
        "zipCode": "361000",
        "city": "Xiamen",
        "state": "Fujian",
        "country": "China"
      },
      {
        "customerId": 50086121,
        "firstName": "Naomi",
        "lastName": "Nicholas",
        "company": "Example company",
        "email": "naomi@example.com",
        "mobileNumber":"139111XXXXX"
      },
      {
        "customerId": 50086122,
        "firstName": "Ashley",
        "lastName": "Gardner",
        "company": "Example company",
        "email": "ashley@example.com",
        "faxNumber":"001-111-1111"
      }
    ]
  },
  "requestId": "bff89f41bb695e5abb84c45972d24716",
  "status": "Success",
  "time": 1664248965
}