Glue API: Manage customers
Edit on GitHubThe Customer API allows creating customers and manage their account data. This includes the possibility to maintain a set of customer addresses as separate resources. In the checkout process, you can retrieve and use these address resources to speed up the buying process. The API supports authentication via OAuth 2.0 and password restoration.
In your development, these resources can help you:
- Retrieve relevant customer information. for any page where it is needed.
- Retrieve customer subscriptions to availability notifications.
- Enable customer registration.
- Allow customer login and authentication.
- Enrich customer profiles with additional data such as addresses.
Installation
For details on the modules that provide the API functionality and how to install them, see Glue API: Customer Access Feature Integration.
Retrieve customers
To retrieve customers, send the request:
GET
/customers/
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer to send requests to protected resources. Get it by authenticating as a customer. |
Request sample: retrieve customers
GET https://glue.mysprykershop.com/customers
Response
Response sample: retrieve customers
{
"data": [
{
"type": "customers",
"id": "DE--21",
"attributes": {
"firstName": "Sonia",
"lastName": "Wagner",
"email": "sonia@spryker.com",
"gender": "Female",
"dateOfBirth": null,
"salutation": "Ms",
"createdAt": "2020-10-07 07:02:32.683823",
"updatedAt": "2020-10-07 07:02:32.683823"
},
"links": {
"self": "https://glue.mysprykershop.com/customers/DE--21"
}
}
],
"links": {
"self": "http://glue.mysprykershop.com/customers"
}
}
See Create a customer to learn about the response attributes.
Retrieve a customer
To retrieve information about a customer, send the request:
GET
/customers/{{customerReference}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customerReference}} | Unique identifier of the customer to get information for. This parameter is returned as the id attribute when creating a customer. |
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer to send requests to protected resources. Get it by authenticating as a customer. |
Request sample: Retrieve a customer
GET http://glue.mysprykershop.com/customers/DE-25
Response
Response sample: retrieve a customer
{
"data": {
"type": "customers",
"id": "DE--25",
"attributes": {
"firstName": "John",
"lastName": "Doe",
"gender": null,
"dateOfBirth": null,
"salutation": "Mr",
"createdAt": "2018-11-06 08:15:02.694668",
"updatedAt": "2018-11-06 08:15:02.694668"
},
"links": {
"self": "http://glue.mysprykershop.com/customers/DE--25"
}
}
}
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
firstName | String | Customer’s first name. |
lastName | String | Customer’s last name. |
String | Customer’s email address. | |
gender | String | Customer’s gender. |
dateOfBirth | String | Customer’s date of birth. |
salutation | String | Salutation to use when addressing the customer. |
createdAt | String | Account creation date. |
updatedAt | String | Date of the last update. |
Edit a customer
To edit a customer account, send the request:
PATCH
/customers/{{customerReference}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customerReference}} | Unique identifier of the customer to edit. This parameter is returned as the id attribute when creating a customer. If you’ve already created a customer, retrieve customers to get it. |
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer which you want to edit. Get it by authenticating as a customer. |
Request sample: edit a customer
PATCH http://glue.mysprykershop.com/customers/DE-25
{
"data" : {
"type": "customers"
"attributes": {
"lastName": "Johnson",
"email": "sonia@spryker.com",
}
}
}
Response
Response sample: edit a customer
{
"data": {
"type": "customers",
"id": "DE--25",
"attributes": {
"firstName": null,
"lastName": "Johnson",
"salutation": null,
"email": "sonia@spryker.com"
},
"links": {
"self": "http://mysprykershop.com/customers/DE--25"
}
}
}
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
firstName | String | Customer’s first name. |
lastName | String | Customer’s last name. |
String | Customer’s email address. | |
gender | String | Customer’s gender. |
dateOfBirth | String | Customer’s date of birth. |
salutation | String | Salutation to use when addressing the customer. |
createdAt | String | Account creation date. |
updatedAt | String | Date of the last update. |
Anonymize a customer
To anonymize a customer, send the request:
DELETE
/customers/{{customerReference}}
PATH PARAMETER | DESCRIPTION |
---|---|
{{customerReference}} | Unique identifier of the customer to anonimyze. This parameter is returned as the id attribute when creating a customer. If you’ve already created a customer, retrieve customers to get it. |
Request
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer which you want to anonymize. Get it by authenticating as a customer. |
Request sample: anonymize a customer
DELETE http://mysprykershop.com/customers/DE-25
Response
If the customer is anonymized successfully, the endpoint returns the 204 No Content
status code.
Retrieve subscriptions to availability notifications
To retrieve subscriptions to availability notifications, send the request:
GET
/customers/{{customerReference}}/availability-notifications
PATH PARAMETER | DESCRIPTION |
---|---|
{{customerReference}} | Unique identifier of the customer to retrieve the subscriptions of. This parameter is returned as the id attribute when creating a customer or retrieving a customer. |
HEADER KEY | HEADER VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
Authorization | string | ✓ | Alphanumeric string that authorizes the customer or company user to send requests to protected resources. Get it by authenticating as a customer. |
Request
Request sample: retrieve subscriptions to availability notifications
GET https://glue.mysprykershop.com/customers/DE--21/availability-notifications
Response
Response sample: retrieve subscriptions to availability notifications
{
"data": [
{
"type": "availability-notifications",
"id": "d634981b8d1930f7db6e2780b7d5600a",
"attributes": {
"localeName": "en_US",
"email": "sonia@spryker.com",
"sku": "190_25111746"
},
"links": {
"self": "https://glue.69.demo-spryker.com:80/availability-notifications/d634981b8d1930f7db6e2780b7d5600a"
}
}
],
"links": {
"self": "https://glue.69.demo-spryker.com:80/customers/DE--21/availability-notifications"
}
}
ATTRIBUTE | TYPE | DESCRIPTION |
---|---|---|
localeName | string | Locale of the subscribed customer. |
string | Customer email where the product availability email notifications are sent to. | |
sku | string | SKU of the product the user receives notifications about. |
Other management options
There is an alternative way to retrieve existing subscriptions, for details see Retrieve subscriptions to availability notifications.
Possible errors
CODE | REASON |
---|---|
001 | Access token is invalid. |
002 | Access token is missing. |
400 | Customer with the same email address already exists. |
402 | Customer with the specified ID was not found. |
405 | Customer reference is missing. |
406 | New password and password confirmation do not match. |
410 | Failed to save changes. |
414 | Provided gender is invalid. |
420 | The password character set is invalid. |
422 | newPassword and confirmPassword values are not identic. |
802 | Request is unauthorized. |
901 | Indicates one of the following reasons:
|
4606 | Request is unauthorized. |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.
Next steps
Thank you!
For submitting the form