Skip to main content

Get all Customers

GET Get a list of all customers​

https://useast.api.elasticpath.com/v2/customers

Parameters​

Headers​

NameRequiredTypeDescription
AuthorizationRequiredstringThe Bearer token required to get access to the API. Grant type must be client_credentials.

Query parameters​

NameRequiredTypeDescription
filterOptionalstringFilter the results. For more information, see Filtering customers.
page[limit]OptionalintegerThe number of records per page.
page[offset]OptionalintegerThe number of records to offset the results by.
sortOptionalstringSpecifies the attribute to sort by. Supported attributes are created_at,email,id,name,updated_at. By default, sort order is ascending. To sort in descending order, prefix the attribute with -, for example, -updated_at. The default value is created_at in descending order. For more information, see Sorting.
note

You can use pagination with this resource. For more information, see pagination.

Filtering​

The following table describes the supported operator and attributes when filtering customers.

AttributeTypeOperatorsExample
emailstring
  • eq
  • like
eq(email,ronswanson@example.com)
namestring
  • eq
  • like
like(name,*swan*)
id`string
  • eq
  • ge
  • gt
  • le
  • lt
eq(id,787af9a4-83e1-4216-bc60-df076daef0c5)
created_atstring
  • eq
  • ge
  • gt
  • le
  • lt
gt(created_at,"2021-06-02T18:44:07.617Z")
updated_atstring
  • eq
  • ge
  • gt
  • le
  • lt
ge(updated_at,"2021-06-07T18:24:48.149Z")
external_refstringeqeq(external_ref,"16bedceb-8b2d-4f82-a973-b0a8d8432708")

Request Examples​

Curl​

curl -X GET https://useast.api.elasticpath.com/v2/customers \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \

JavaScript SDK​

const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
client_id: "X",
});
Moltin.Customers.All().then((customer) => {
// Do something
});
//Filter example
Moltin.Customers.Filter({ eq: { email: "jim@bob.com" } })
.All()
.then((customers) => {
// Do something
});

Response Example​

200 OK

{
"data": [
{
"type": "customer",
"id": "2479c9b3-615d-4ebc-a99d-87ffc67d1955",
"name": "Ron Swanson",
"email": "ron@swanson.com",
"password": true,
"meta": {
"timestamps": {
"created_at": "2017-01-11T18:44:45Z",
"updated_at": "2017-05-31T04:12:12Z"
}
}
},
{
"type": "customer",
"id": "7746d533-fd64-446f-ae8c-f8e07f3ed9fd",
"name": "Ron Swanson_",
"email": "ron_@swanson.com",
"external_ref": "16bedceb-8b2d-4f82-a973-b0a8d8432708",
"password": true,
"meta": {
"timestamps": {
"created_at": "2017-02-20T17:31:45Z",
"updated_at": "2017-04-14T18:55:59Z"
}
}
}
],
"meta": {
"page": {
"limit": 10,
"offset": 0,
"current": 1,
"total": 1
},
"results": {
"total": 2
}
}
}