<user name>
from your account manager. It is usually customer_interface
for the customer interface, but it might be different depending on the project.<user name>:
Value of HTTP header Authentication contains BASE64 encoded string <user name>:
. The request looks like this:
POST <projectURL>/rest-api/customer-interface/v1.0/tokens
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOiA=
{
"data":{
"token_id":<token_id>
}
}
<user name>:<token_id>
HTTP Authorization header looks similar to:
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOiA=
<token_id>
in the HTTP Authorization header as is in step nr. 4. Put right customer credentials in the request's body after.Note: Do not copy the credentials below. Code is just an example of a method used.
{
"login_type": "email",
"login_value": "example@crmcarecloud.com",
"password": "password_example"
}
{
"data":{
"customer_id":<customer_id>
}
}
You should know all the values for the mandatory/optional customer account parameters before creating a customer account by [badge-green POST] /customers. Use any available resource you need to get the lists of actual values. We will use resource stores in this example. To get all options for store_id
you should call [badge-blue GET] /stores. Parameter store_id
will be set during the customer account creation process.
GET <projectURL>/rest-api/customer-interface/v1.0/stores
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
#<user name>:<token>
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOmNlMzZjMDg2YmZjN2U3YjBkMjNjNjY3YjdhOTUxZTk=
You will get a response containing the list of stores and their unique IDs.
"data": {
"stores": [
{
"store_id": "86e05affc7a7abefc",
"store_code": "",
"name": "Ice Cream HQ",
"store_address": {
"address1": "Main",
"address2": "18",
"address3": null,
"address4": null,
"address5": null,
"address6": null,
"address7": null,
"zip": "11000",
"city": "Prague",
"country_code": "cz"
},
"contact_email": "",
"manager_name": "",
"phone_number": "",
"partner_id": "86e05affc7a7abe",
"system_id": "A23753",
"gps_coordinates": {
"gps_longitude": 0,
"gps_latitude": 0
},
"url_address": "",
"opening": [],
"image_urls": [],
"last_change": "2018-12-19 16:12:56"
}
]
}
You will get a response containing the list of stores and their unique IDs.
Use the method [badge-green POST] /customers to create a customer account and set store_id
as the registration branch of a customer account.
Header:
POST <projectURL>/rest-api/customer-interface/v1.0/customers
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
#<user name>:<token>
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOmNlMzZjMDg2YmZjN2U3YjBkMjNjNjY3YjdhOTUxZTk=
Request body:
{
"customer_sources": [
{
"customer_source_id": "0b1788109b8",
"external_id": "94826712"
}
],
"personal_information": {
"gender": 1,
"first_name": "John",
"last_name": "Smith",
"email": "happy_customer@crmcarecloud.com",
"language_id": "en",
"store_id": "86e05affc7a7abefc",
"birthdate": "1993-01-21",
"phone": "420221634695",
"address": {
"address1": "Old Town Square",
"address2": "35",
"zip": 11000,
"city": "Prague",
"country_code": "cz"
},
"agreement":{
"agreement_gtc": 2,
"agreement_profiling": 2,
"agreement_marketing_communication": 2
}
},
"additional_properties": [
{
"property_id":"wedding_date",
"property_name":"Date of wedding",
"property_value":"2001-08-13",
"last_change":"2019-04-15 14:37:3.574408"
}
],
"social_network_credentials": {
"social_network_id": "twitter",
"social_network_token": "38e123j1jedu12d1jnjqwd"
},
"autologin": false,
"password": ""
}
Set all the parameters according to the documentation and get a response including customer_id
.
{
"data":{
"customer_id":"8bababca29337fcf"
}
}
To save a value of interest on a customer account use the interest-records subresource as follows:
POST <projectURL>/rest-api/customer-interface/v1.0/customers/8bababca29337fcf/interst-records
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
#<user name>:<token>
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOmNlMzZjMDg2YmZjN2U3YjBkMjNjNjY3YjdhOTUxZTk=
{
"interest_record": {
"interest_id": "87d706e4864d02af7",
"customer_id": "8bababca29337fcf"
}
}
You will get a response including the interest record unique id.
{
"interest_record_id":"fdsdfe7nh640"
}
Use a similar process to set a property value on a customer account. Use subresource property-records as follows:
POST <projectURL>/rest-api/customer-interface/v1.0/customers/8bababca29337fcf/property-records
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
#<user name>:<token>
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOmNlMzZjMDg2YmZjN2U3YjBkMjNjNjY3YjdhOTUxZTk=
{
"property_record": {
"property_id": "87d76e48264d026dpab0f7",
"customer_id": "8bababca29337fcf"
}
}
You will get a response with the property record id.
{
"property_record_id":"fdsdfbfkdsioe7532"
}
Every resource in API has a list of parameters, that are static. As we know, every client has different requirements, and that's why we have additional properties structure in some of our resources. The additional properties contain list of a properties, that can be used by clients to set up a properties that are not used in the main parameters of a resource. The additional properties make API flexible to use.
Resource [badge-blue GET] /rewards contains an additional properties parameter. Additional properties have the same strutcure throughout the API.
API call of the resource [badge-blue GET] /rewards can show us all properties and the values of that resource:
POST <projectURL>/rest-api/customer-interface/v1.0/rewards
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
#<user name>:<token>
Authorization: Basic Y3VzdG9tZXJfaW50ZXJmYWNlOmNlMzZjMDg2YmZjN2U3YjBkMjNjNjY3YjdhOTUxZTk=
"data": {
"rewards": [
{
"reward_id": "8bdf68d3838b4e009991819e85",
"code": "",
"name": "Letní balíček 2017",
"note": null,
...
"additional_properties": [
{
"property_record_id": "global:8bdf68d3838b4e009991819e85",
"property_id": "global",
"property_name": "Global setup of reward",
"property_value": true,
"last_change": "2017-06-14 10:43:49.882375"
}
],
"priority": null,
"image_urls": [],
"last_change": "2017-06-14 10:43:49.882375",
"state": 1
},
...