Creation of a customer account process

  1. 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=
  2. 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"
      }
    ]   
    }
  3. 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": ""
    }
  4. Set all the parameters according to the documentation and get a response including customer_id.

    {
    "data":{
        "customer_id":"8bababca29337fcf"
    }
    }
  5. Customers subresources can be set during the process of a customer account creation. Customer's interests and properties will be set in the next steps. Lists of all available interests and properties are available using the [badge-blue GET] /interests and [badge-blue GET] /customer-properties.
  6. 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"
    }
    }
  7. You will get a response including the interest record unique id.

    {
    "interest_record_id":"fdsdfe7nh640"
    }
  8. 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"
    }
    }
  9. You will get a response with the property record id.

    {
    "property_record_id":"fdsdfbfkdsioe7532"
    }
  10. Repeat POST method calls if you need to set more property-records or interest-records on a customer account.