Creating a customer

Please make sure you read the Conventions before continuing with this guide.

Requirements.

You will need an X-API-KEY for all steps.

1) Create a customer.

You will interact with the /accounts/customer endpoint of the Accounts Bucket to create a customer.

When successful, a customer json object will be returned.

Response :

{
    "customerNumber": "123-123-123",
    "accountId": "55555xx55yy55z000000000",
    "agencyId": "",
    "firstName": "Firstname-Test",
    "lastName": "Lastname-Test",
    "email": "test@betterez.com",
    "phone": "",
    "street": "",
    "city": "",
    "countryId": "",
    "country": "",
    "province": "",
    "zip": "",
    "optIn": false,
    "activeCustomerAccount": false,
    "credentials": {
        "emailAndPwd": {}
    },
    "mergedFrom": [],
    "mergedTo": "",
    "cloutCategory": "Newbie",
    "clout": {
        "p0000_00": {
            "purchases": 0,
            "travels": 0,
            "purchasesValue": 0,
            "travelsValue": 0
        }
    },
    "deleted": false,
    "createdAt": {
        "value": "2017-11-29T16:38:08.533Z",
        "offset": 0
    },
    "updatedAt": {
        "value": "2017-11-29T16:38:08.533Z",
        "offset": 0
    },
    "_id": "5a466f555555df550b555555"
}

2) Create a customer password.

You will interact with the /accounts/customers/{{customerId}}/password endpoint of the Accounts Bucket to create a customer.

You will need to use the value of "_id" from the customer object returned in Step 1 as the {{customerId}} ("5a466f555555df550b555555").

Response :

Return 200 OK

3) Retrieve an activation token.

You will interact with the /accounts/tokens endpoint of the Accounts Bucket to retrieve a token from activating a customer.

The {{customerNumber}} will have been returned in Step 1 ("123-123-123").

When successful, a token will be returned.

Response :

{
    "result": {
        "token": "5a55555f5322df550b555555"
    }
}

4) Activate the account.

You will interact with the /accounts/customers/{{customerId}} endpoint of the Accounts Bucket to retrieve a token from activating a customer. The {{token}} will have been returned in Step 3.

When successful, a json customer and provider object as well as tokens will be returned.

You can check the response on customer login for a detailed response.