The Customer information resource manages the customer's account/information. It offers the following options:
Important: The customers' addresses can be managed through the Addresses resource.
Get customer information
Getting information for unconnected users will result in an error code 10: user is not connected
View more information about Authentication(Login) >>
Example
https://wsmedia.tlsecure.com/api/json/00000/customer/
Request
HTTP Verb : GET
URL : http://{WS_URL}/api/{returnType}/{domainCode}/customer
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v |
Response
Success
{ "response": { "success": true "message": "user info retrieved" "object": { "customer": { "id": 586 "role": 1 "email": "spiderman@marvel.com" "login": "spiderman" "b2b": false "newsletter": false "creationDate": "2016-03-01" "waitingEmailValidation": false } } } }
Error
{ "response": { "success": false "code": 10 "message": "user not connected" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | get user info |
1 | domaincode malformed | |
2 | connexion error | |
3 | token is empty | |
4 | no token with that key | |
5 | invalid token | |
10 | user not connected | |
99 | uncatched exception |
Create customer
A customer can't register a new account if he's already connected via the login webservice.
View more information about Authentication(Logout) >>
When created, an email is sent to the customers' e-mailaddress (see e-mail configuration). This e-mail contains a link the customer needs to visit in order to confirm his e-mailaddress. See the validation service for more information.
Example
https://wsmedia.tlsecure.com/api/json/00000/customer/
Request
HTTP Verb : POST
URL : http://{WS_URL}/api/{returnType}/{domainCode}/customer
The password passed in the call has to be encrypted and salted.
Contact us for the encryption algorithm.
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
login | Form | String | v | ||
password | Form | String | v | ||
Form | String | v | |||
title | Form | String | |||
firstname | Form | String | |||
lastname | Form | String | |||
prefix | Form | String | |||
birthdate | Form | Date | Format : yyyy-MM-dd | ||
company | Form | String | |||
language | Form | Integer | 1 | ||
newsletter | Form | Integer | 0 | ||
extra1 | Form | String | |||
extra2 | Form | String | |||
extra3 | Form | String | |||
favoriteShop | Form | Integer | |||
confirmationRequired | Form | Boolean |
With confirmationRequired set to false, the customer won't receive an email, and so won't have to confirm his email address before logging in. Then, he's automatically logged in.
Response
Success
{ "response": { "success": true "message": "user created" "object": { "customer": { "id": 1043 "role": 1 "email": "spiderman@marvel.com" "login": "spiderman" "b2b": false "newsletter": false "waitingEmailValidation": true } } } }
Error
{ "response": { "success": false "code": 12 "message": "login already exist" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | user created |
1 | domaincode malformed | |
2 | connexion error | |
3 | token is empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} is not {type} {(or undefined)} | |
10 | already logged in | |
11 | email address already exist | |
12 | login already exist | |
13 | account not validated | |
14 | language key doesn't exist | |
15 | favorite shop id doens't exist | |
16 | account imported but not yet ready (should use lost password) | |
99 | uncatched exception |
Update customer
Example
https://wsmedia.tlsecure.com/api/json/00000/customer/
Request
HTTP Verb : PUT
URL : http://{WS_URL}/api/{returnType}/{domainCode}/customer
Parameters in path
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v | ||
Content-Type | Header | String | v | application/x-www-form-urlencoded | |
password | Form | String(40) | |||
Form | String | ||||
title | Form | String | |||
firstname | Form | String | |||
lastname | Form | String | |||
prefix | Form | String | |||
birthdate | Form | Date | |||
company | Form | String | |||
language | Form | Integer | |||
newsletter | Form | Boolean | |||
extra1 | Form | String | |||
extra2 | Form | String | |||
extra3 | Form | String | |||
favoriteShop | Form | Integer |
Response
Success
{ "response": { "success": true "code": 0 "message": "user updated" "object": { "customer": { "id": 1043 "role": 1 "email": "spiderman@avengers.com" "login": "spiderman" "birthdate": "1982-05-06" "b2b": false "creationDate": "2016-03-04" "waitingEmailValidation": false } } } }
Error
{ "response": { "success": false, "code": 11, "message": "email already exist" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | user updated |
1 | domaincode malformed | |
2 | connexion error | |
3 | token is empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} is not {type} {(or undefined)} | |
10 | user not connected | |
11 | email already exist | |
14 | language key doesn't exist | |
15 | favorite shop id doens't exist | |
99 | uncatched exception |
Addresses
Addresses are not part of the Customer information resource and is handled as a proper resource.
View more information about the addresses >>
Resend confirmation mail
If a user can't log in because her or his account hasn't been validated, a confirmation mail may be resent by calling this service.
Example
https://wsmedia.tlsecure.com/api/json/00000/customer/resend?email=spiderman@marvel.com
Request
HTTP Verb : GET
URL : http://{WS_URL}/{returnType}/{domainCode}/customer/resend
Parameters in path
Parameters | Location | Type | Required | Default | Accepted |
---|---|---|---|---|---|
token | Header | String(26) | v | ||
Query | String |
Response
Success
{ "response": { "success": true "code": 0 "message": "subscription resend" } }
Error
{ "response": { "success": false "code": 12 "message": "user not waiting validation" } }
Codelist
Code | Success | Message |
---|---|---|
0 | v | subscription resend |
1 | domaincode malformed | |
2 | connexion error | |
3 | token empty | |
4 | no token with that key | |
5 | invalid token | |
9 | {param} not {type} {(or undefined)} | |
10 | already logged in | |
11 | user not exist | |
12 | user not waiting validation | |
99 | uncatched exception |