Customer Sign In
Customers can sign in via the /api/v4/auth/sign_in endpoint. The following example explains how to do it.
POST https://demo.gomus.de/api/v4/auth
curl 'https://demo.gomus.de/api/v4/auth/sign_in?locale=de' \
-X 'POST' \
-H 'X-Shop-Url: demo-shop.gomus.de' \
--data-raw $'{"email":"shop-customer@giantmonkey.de","password":"meowmeowmeow"}'
Response
The above command returns JSON structured like this:
{
"data": {
"category_id": null,
"created_at": "2020-05-12T11:51:26+02:00",
"customer_salutation_id": 1,
"customer_title_id": null,
"debitor_number": 10003,
"email": "shop-customer@giantmonkey.de",
"fax": null,
"has_collective_invoice_payment": false,
"has_voucher_payment": false,
"id": 402,
"institution": null,
"is_institution": false,
"language_id": 1,
"level": 20,
"mobile": "",
"name": "Bruce",
"notes": null,
"payment_mode_id": null,
"price_target_audience_id": 1,
"provider": "email",
"surname": "Wayne",
"tel": null,
"updated_at": "2021-06-07T13:13:54+02:00",
"newsletter_groups": "8,1",
"wants_newsletter": true,
"salutation": "Herr"
}
}
The JSON response contains a list of customer attributes, some of them are:
- id (integer), the unique database id of the customer
- newsletter_groups (string), a comma separated list of newsletter group ids that the customer is assigned to after the update
Moreover, important authorization headers like: access-token
, token-type
, client
and uid
are also returned.
Customer Update
Subscribe to newsletter groups
Customer can be updated via the auth endpoint, the following example explains how to update which newsletter groups are assigned to it.
Authorization headers such as: access-token, token-type, client and uid headers can be obtained from the /api/v4/auth/sign_in endpoint.
It’s possible unsubscribe from all newsletters by sending an empty string.
PUT https://demo.gomus.de/api/v4/auth
curl 'https://demo.gomus.de/api/v4/auth?locale=de' \
-X 'PUT' \
-H 'access-token: meowmeow' \
-H 'client: meowmeow' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'X-Shop-Url: demo-shop.gomus.de' \
-H 'Accept: application/json, text/plain, */*' \
-H 'uid: meowmeow' \
-H 'token-type: Bearer' \
--data-raw '{"newsletter_groups":"1,8"}'
The above command returns JSON structured like this:
{
"status": "success",
"data": {
"category_id": null,
"created_at": "2020-05-12T11:51:26+02:00",
"customer_salutation_id": 1,
"customer_title_id": null,
"debitor_number": 10003,
"email": "shop-customer@giantmonkey.de",
"fax": null,
"has_collective_invoice_payment": false,
"has_voucher_payment": false,
"id": 402,
"institution": null,
"is_institution": false,
"language_id": 1,
"level": 20,
"mobile": "",
"name": "Bruce",
"notes": null,
"payment_mode_id": null,
"price_target_audience_id": 1,
"provider": "email",
"surname": "Wayne",
"tel": null,
"updated_at": "2021-06-07T13:13:54+02:00",
"newsletter_groups": "8,1",
"wants_newsletter": true,
"salutation": "Herr"
}
}
Response
The JSON response contains a list of customer attributes, some of them are:
- id (integer), the unique database id of the customer
- newsletter_groups (string), a comma separated list of newsletter group ids that the customer is assigned to after the update
Errors
The go~mus API uses the following error codes:
Error Code | Meaning |
---|---|
401 | Unauthorized – Your API key is wrong |
403 | Forbidden – The API endpoint requested is for administrators only |
404 | Not Found – The specified record could not be found |
405 | Method Not Allowed – You tried to access an API endpoint with an invalid method |
422 | Unprocessable Entity – The data you have passed cannot be processed |
429 | Too Many Requests – You’re requesting too much! Slow down! |
500 | Internal Server Error – We had a problem with our server. Try again later. |
503 | Service Unavailable – We’re temporarially offline for maintanance. Please try again later. |