Customer related creation, updating and removal
The customer is the cornerstone entity in Ahiko B2C offering. You require a customer in order to associate residential addresses (properties) to an ICP.
Prerequisites
Before you can follow this guide, you will need:
- To be able to make a request in your programming language of choice, our API reference has example requests using multiple common languages and libraries, just look for the "Language" dropdown at the top of the page.
- Your subscription key (32 alphanumerical combination key).
Supported Requests
Using your language of choice, make a GET request to the <https://api.ahiko.io/customer/v1/customers> endpoint, with the following headers:
Authorization: Bearer {{user access token}}
ahiko-app-id {{application subscription key}}
Where the {{application subscription key}} is replaced with your application subscription key.
Get a Customer - GET
Obtaining a customer can be done providing a customer's email address. A successful retrieval of a customer will result in a response that will look like:
{
"success":true,
"data:{
"customer_id": "123",
"created_at": "2023-09-06T18:01:07.908190Z",
"updated_at": "2023-09-16T18:02:27.093721Z",
"first_name": "John",
"last_name": "Doe",
"auth_user_id":"auth0|abc123",
"email_address" : "[email protected]",
"customer_lifecycle": ["active" | "inactive","auth_pending"]
"property_list": [] ]
}
}
Let's break this response down:
customer_id : stringThe unique guid of a customer that has been generatedcreated_at : datetimeTime the customer was very first created, typically upon signupupdated_at : datetimeLast time any property of the customer was updatedfirst_name : stringThe first name of the associated customer.last_name : stringThe last name of the associated customer.auth_user_id : stringThe auth platform's unique user-name, user to identify you.email_address : stringThe email address of the associated customer.customer_lifecycle : string (enum:[active|inactive|auto_pending])The phase of the customer life cycle the customer is in. Inactive means that the customer's account has been closed, auth_pending means that the customer has been created, but not in the auth platform (Auth0 presently) otherwise they are considered active.property_list : listCovered by the ⚡︎ Location specific API commentary
Get all Customers - GET
Obtaining all customers can be done by just invoking the endpoint directly. A successful retrieval of customers will result in a response that will look like:
{
"success":true,
"data:{[
"customer_id": "123",
"email_address" : "[email protected]"]}
}
Let's break this response down:
customer_id : stringThe unique guid of a customer that has been generatedemail_address : stringThe email address of the associated customer.
Update a Customer - PATCH
Update of a distinct single field of a customer, the valid attributes that can be patched include:
first_name : stringlast_name : stringauth_user_id : string
Any update will cause the updated_at to be updated internally to reflect the change.
The associated response will look like:
{
"success": true,
}
Create a Customer - POST
Used to create a customer consisting of 2 pieces of information:
first_name : stringThe first name of the associated customer.last_name : stringThe last name of the associated customer.
The successful creation of a customer will result in a response that will look like
{
"success": true,
"customer_id": "customer_123abc"
}
Let's break this response down:
success : boolSuccess of the requestcustomer_id : stringThe unique guid of a customer that has been generated
{
"success": true,
}
Handling Errors
The Ahiko API returns standard HTTP response codes.
Below are the most common error codes and their reasons:
200Everything is OK. The response is included in the body.404The url does not exist. Check you have entered the url correctly.403You are not allowed to access this resource. Make sure you have a valid user access token with the correct permissions. Also make sure you have set the Authorization header correctly (note the American spelling).
