Customers

CRM CareCloud is about 360 view on a Customer and all relationships of the Customer. Resource Customers is used for managing this basic entity, which contains personal and all additional related information about the Customer.

Available methods

Available methods for resource customers.

HTTP method Endpoint Description
[badge-green POST] /customers Add a new customer account
[badge-blue GET ] /customers Get a list of all customers
[badge-blue GET ] /customers/{customer_id} Get information about a specific customer
[badge-grey PUT] /customers/{customer_id} Update the information about a customer

Available methods with sub-resources

All available methods for sub-resources of resource customer.

HTTP method Endpoint Description
[badge-blue GET] /customers/{customer_id}/purchases Get a list of all purchases of a customer
[badge-blue GET] /customers/{customer_id}/points Get a list of all point records of a customer
[badge-blue GET ] /customers/{customer_id}/credits Get a list of all credit records of a customer
[badge-blue GET] /customers/{customer_id}/vouchers Get a list of all vouchers of a customer
[badge-blue GET] /customers/{customer_id}/rewards Get a list of all rewards of a customer
[badge-blue GET] /customers/{customer_id}/cards Get a list of all cards of a customer
[badge-blue GET] /customers/{customer_id}/segment-records Get a list of all segments to which a customer belongs
[badge-blue GET] /customers/{customer_id}/status-records Get a list of all status records of the customer
[badge-blue GET] /customers/{customer_id}/recommendation-records Get a list of all recommendations to a customer
[badge-blue GET] /customers/{customer_id}/customer-source-records Get a list of all customer source records
[badge-blue GET] /customers/{customer_id}/property-records Get a list of all customer's property records
[badge-green POST] /customers/{customer_id}/property-records Add a new customer property record
[badge-grey PUT] /customers/{customer_id}/property-records/{property_id} Update a customer property record
[badge-red DELETE] /customers/{customer_id}/property-records/{property_id} Delete a customer property record
[badge-blue GET] /customers/{customer_id}/interest-records/ Get a list of customer interest records
[badge-green POST] /customers/{customer_id}/interest-records/ Create a customer interest record
[badge-grey PUT] /customers/{customer_id}/interest-records/{interest_record_id} Update a customer interest record
[badge-red DELETE] /customers/{customer_id}/interest-records/{interest_record_id} Delete a customer interest record

Actions

Action methods for resource customers.

HTTP method Endpoint Description
[badge-green POST] /customers/actions/verify-credentials Customer credentials verification
[badge-green POST] /customers/actions/verify-social-network-credentials Customer Social network credentials verification
[badge-blue GET] /customers/actions/search-customers Search all customers matching for parameters
[badge-green POST] /customers/actions/verify-auth-token Verifies authentication token and returns the unique id of the customer
(available in Enterprise interface access only)

Action methods are available only in Enterprise interface.


Create a new customer

Add a new customer account in CRM CareCloud
[badge-green POST] /customers

Request

Parameter name Type Description Mandatory (Yes/No)
customer Customer Basic information about a customer Yes
customer_source CustomerSourceRecord Customer source Yes
password string Password of the customer. Password must satisfy the following criteria and contain: At least one number (Example: 1 2 3); At least one uppercase letter (Example: A B C); Minimum lenght of password is 8 characters; Password is not part of a common password list (Example: abc123, password, 12345) No
autologin boolean If true, password is required and customer is logged in. Otherwise password is optional Yes
social_network_credentials SocialNetworkCredentials Customer Social network credentials No

Response

Status code: 201 Created
Output structure : object

Parameter name Type Description
customer_id string The unique id for the customer

Example request

POST <projectURL>/rest-api/customer-interface/v1.0/customers
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

{
    "customer": {
        "personal_information": {
            "gender": 2,
            "first_name": "John",
            "last_name": "Smith",
            "email": "happy_customer@crmcarecloud.com",
            "language_id": "en",
            "store_id": "88dab5c7c6034ba59f886f4a",
            "birthdate": "1991-03-27",
            "phone": "420170134844",
            "address": {
                "address1": "Old Town Square",
                "address2": "34",
                "address3": "34",
                "zip": "11000",
                "city": "Prague 1",
                "country_code": "cz"
            },
            "agreement": {
                "agreement_gtc": 1,
                "agreement_profiling": 1,
                "agreement_marketing_communication": 1
            }
        }
    },
    "customer_source": {
        "customer_source_id": "8bd253a89059008f1d44aa",
        "name": "mobile application"
    },
    "autologin": false
}

Example response

HTTP/1.1 201 Created
Date: Mon, 22 Jul 2019 11:51:36 GMT
Content-Type: application/json; charset=utf-8

{
    "data":{
        "customer_id":"8bababca29337fcfc92eaad8ab"
    }
}


Get all customers

[badge-blue GET] /customers
Get a list of all customer accounts

Query string

Parameter name Type Description Mandatory (Yes/No)
count integer The number of records to return.
Default value is 100.
No
offset integer The number of records from a collection to skip.
Default value is 0.
No
sort_field string One of the query string parameters for sorting.
Response is sorted by the specified field.
No
sort_direction string Direction of sorting the response list.
Possible values are: ASC / DESC
No
email string Search customers by email. No
phone string Search phone number of the customer with international prefix (420000000) No
customer_source_id string Search by customer account source. No
first_name string Search by cutomer first name No
last_name string Search by customer last name No
birthdate string Search customers by birthdate. Possible values are: YYYY-MM-DD / DD.MM.YYYY No

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
customers Customer[ ] Array of customers
total_items integer Count of all found customers

Example request

GET http:<projectURL>/rest-api/customer-interface/v1.0/customers
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

Example response

HTTP/1.1 200 OK
Date: Mon, 22 Jul 2019 11:54:39 GMT
Content-Type: application/json; charset=utf-8

{
    "data": {
        "customers": [
            {
                "customer_id": "8ea6abece4cd0a4ded0a29f093",
                "personal_information": {
                    "gender": 1,
                    "first_name": "John",
                    "last_name": "Smith",
                    "birthdate": "985-02-12",
                    "email": "happy_customer@crmcarecloud.com",
                    "phone": "420523828931",
                    "language_id": "en",
                    "store_id": "8bed991c68a4",
                    "address": {
                        "address1": "Old Town Square",
                        "address2": "34",
                        "address3": "",
                        "address4": "",
                        "address5": "",
                        "address6": "",
                        "address7": "",
                        "zip": "11000",
                        "city": "Prague 1",
                        "country_code": "cz"
                    },
                    "agreement": {
                        "agreement_gtc": 1,
                        "agreement_profiling": 1,
                        "agreement_marketing_communication": 1,
                        "custom_agreements": [
                            {
                                "agreement_id": "custom_agreement_id",
                                "agreement_value": 2
                            }
                        ]
                    }
                },
                "last_change": "2019-06-23 11:47:22",
                "state": 1
            }
        ],
        "total_items": 1
    }
}


Get information about a customer

Get information about a specific customer account
[badge-blue GET] /customers/{customer_id}

Path parameters

Parameter name Type Description Mandatory (Yes/No)
customer_id string The unique id for the customer Yes

Response

Status code: 200 OK
Output structure : Customer

Example request

GET http:<projectURL>/rest-api/customer-interface/v1.0/customers/83a2efb32defb80a487ff
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

Example response

HTTP/1.1 200 OK
Date: Mon, 22 Jul 2019 11:54:39 GMT
Content-Type: application/json; charset=utf-8

{
   "data":{
                "customer_id": "8ea6abece4cd0a4ded0a29f093",
                "personal_information": {
                    "gender": 1,
                    "first_name": "John",
                    "last_name": "Smith",
                    "birthdate": "985-02-12",
                    "email": "happy_customer@crmcarecloud.com",
                    "phone": "420523828931",
                    "language_id": "en",
                    "store_id": "8bed991c68a4",
                    "address": {
                        "address1": "Old Town Square",
                        "address2": "34",
                        "address3": "",
                        "address4": "",
                        "address5": "",
                        "address6": "",
                        "address7": "",
                        "zip": "11000",
                        "city": "Prague 1",
                        "country_code": "cz"
                    },
                    "agreement": {
                        "agreement_gtc": 1,
                        "agreement_profiling": 1,
                        "agreement_marketing_communication": 1,
                        "custom_agreements": [
                            {
                                "agreement_id": "custom_agreement_id",
                                "agreement_value": 2
                            }
                        ]
                    }
                },
                "last_change": "2019-06-23 11:47:22",
                "state": 1
            }
}


Update a customer

Update the information on a specific customer account
[badge-grey PUT] /customers

Path parameters

Parameter name Type Description Mandatory (Yes/No)
customer_id string The unique id for the customer Yes

Request

Parameter name Type Description Mandatory (Yes/No)
customer Customer Basic information about the customer Yes
password string Password of customer No
social_network_credentials SocialNetworkCredentials Customer Social network credentials No

Response

Status code: 204 No Content

Example request

PUT http:<projectURL>/rest-api/customer-interface/v1.0/customers/83a2efb32defb80a487ff
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic PEF1dGhvcml6YXRpb24gc3RyaW5nICB3aXRoIHRva2VuIGlkPg==

{
    "personal_information": {
        "gender": 1,
        "first_name": "John",
        "last_name": "Smith",
        "birthdate": "985-02-12",
        "email": "happy_customer@crmcarecloud.com",
        "phone": "420523828931",
        "language_id": "en",
        "store_id": "8bed991c68a4",
        "address": {
            "address1": "Old Town Square",
            "address2": "34",
            "address3": "",
            "address4": "",
            "address5": "",
            "address6": "",
            "address7": "",
            "zip": "11000",
            "city": "Prague 1",
            "country_code": "cz"
        },
        "agreement": {
            "agreement_gtc": 1,
            "agreement_profiling": 1,
            "agreement_marketing_communication": 1,
            "custom_agreements": [
                {
                    "agreement_id": "custom_agreement_id",
                    "agreement_value": 2
                }
            ]
        }
    },
  "social_network_credentials": {
    "social_network_id": "twitter",
    "social_network_token": "38e123j1jedu12d1jnjqwd"
  },
  "password": "fbsdfbkjebf$2,4d4fnb#,ds4@fnm,2dsf6sa"
}

Example response

HTTP/1.1 204 No Content
Date: Mon, 22 Jul 2019 12:13:31 GMT
Content-Type: application/json; charset=utf-8

Customer credentials verification

Verification of a Customer account credentials
[badge-green POST] /customers/actions/verify-credentials

Action method for verification credentials is available only in Enterprise interface.

Request

Parameter name Type Description Mandatory (Yes/No)
login_type string The unique id of the login type (available: card, email) Yes
login_value string Value of the login for customer interface API Yes
password string Password of the Customer Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
customer_id string The unique id of the customer

Response

Status code: 200 OK

Example of request body
{
  "login_type": "email",
  "login_value": "happy_customer@cortex.cz",
  "password": "password123_is_not_a_good_idea"
}
Example of response body
{
    "data":{
      "customer_id": "09359095c5da43c7a78e11e710eabce49418715a6a",
    }
}

Social network credentials verification

Verification of a Customer account Social network credentials
[badge-green POST] /customers/actions/verify-social-network-credentials

Action method for verification credentials is available only in Enterprise interface.

Request

Parameter name Type Description Mandatory (Yes/No)
social_network_credentials SocialNetworkCredentials Credentials for the specific Social network Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
customer_id string The unique id for a logged in customer
Example of request body
{
  "social_network_credentials": {
    "social_network_id": "twitter",
    "social_network_token": "38e123j1jedu12d1jnjqwd"
  }
}
Example of response body
{
    "data":{
        "customer_id":"09359095c5da43c7a78e11e710eabce49418715a6a"
    }
}


Search customers

Search all customers matching for parameters
[badge-green GET] /customers/actions/search-customers

Action method for search customers is available only in Enterprise interface.

Query parameters

Parameter name Type Description Mandatory (Yes/No)
first_name string First name of the customer No
last_name string Last name of the customer No
birthdate string Customer's date of birth (YYYY-MM-DD) No
card_number string Card number No
mode string Mode of search results.
Possible values are: strict - return only 100% matching results, default mode
No

Strict mode makes all path parameters as required. For succesful result you have to set all parameters.

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
strict CustomerResult Result of the search

Example request

GET https://<projectURL>/rest-api/enterprise-interface/v1.0/customers/actions/search-customers?card_number=2001990000016&first_name=Jakub&last_name=B&birthdate=1984-11-06&mode=strict
Content-Type: application/json
Accept-Language: cs, en-gb;q=0.8
Authorization: Basic ZW50ZXJwcmlzZV9pbnRlcmZhY2U6ODEwTU0MTEyNWY1Y2UzNDg5zU2YTE3MDI3MGYyYzUxMGM4MTM5MWJlZDM2ZjU2ODc4MDM0N2MyZjFmNzU4Ng==

Example response

HTTP/1.1 200 OK
Date: Wed, 21 Apr 2021 13:51:37 GMT
Content-Type: application/json; charset=utf-8

{
  "data": {
    "strict": [
      {
        "customer_id": "80c4d97a7136d98a90badb5128",
        "match": 100
      }
    ]
  }
}


Verify auth token

Method verifies authentication token created by a specified application. There is the unique id of the customer as a response.
[badge-green POST] /customers/actions/verify-auth-token

Action method is available only in Enterprise interface.

Request

Parameter name Type Description Mandatory (Yes/No)
application_id string Id of the application. Application is the source of the token Yes
token string Authentication token Yes
token_request_id string The parameter specifies the request that caused the token to be created. If two customers generated an authentication token at the same time and in the same application, the token_request_id parameter represents additional verification to identify the correct token Yes

Response

Status code: 200 OK
Output structure : object

Parameter name Type Description
customer_id string The unique id of the logged in customer
Example of request body
{
  "application_id": "self_order_kiosk",
  "token": "a78e11e774f7f",
  "token_request_id": "e11e7a7f7f610ea8e11e774",
}
Example of response body
{
    "data":{
        "customer_id":"09359095c5da43c7a78e11e710eabce49418715a6a"
    }
}