Request
Request type: POST
URL: {{baseUrl}}/api/v1/customers
Body:
Constraints
If you do not have a phone number (since the API mandates its presence), you can send a placeholder value (e.g. custNoPhone) and later update it.
Success Response
HTTP code: 201 (Created) OR 200 (OK)
Why two response codes?
This API can also Update the customer details.
- The 201 response code indicates that a new customer was created in the database.
- The 200 response code indicates that a customer with existing
external_user_id** was updated**.
- The search for the customer is performed against the
external_user_id
- The values for
email and phone are updated if an existing user is found.
Body:
Meaning of Response field values:
The phone number is not returned back in the response.
Error Responses
Error shall be returned when the data is faulty. Typical HTTP response code shall be 422 (Unprocessable Content). Some examples include (this is not an exhaustive list):
Email Already exists
You cannot create a customer account with same email as that of an existing customer. A response body like below can be expected:
Phone number is not of the right length
Phone number length must be 8-13 characters long. If the input exceeds the range on either side, an error is shown, for example: