Create and obtain Price Plan Comparison Insights

The comparison supports the generation of price comparisons of all plans in the associated properties location (using the network reporting region). Once you have attached a usage snapshot to a property you can generate a comparison report.

How does it work?

Ahiko calculates all possible plan combinations for your provided property and calculate the cost associated with each. Whilst the number of combinations varies depending on where in New Zealand the property is located it's a safe assumption that at least 40-50 variations will be calculated.


The report is then available to inspect. The reports returned are ordered by cost, one-by-one with pagination from each to get the next. The intention is to give you an incredibly detailed report which is we provide details of the report aggregated by (i) day of week, (ii) by month of year and (iii) by time period e.g. "09:30-10:00".

Prerequisites

Steps prior to creating a comparison report:

Step 1 - Create a customer

Step 2 - Create a property for the associated customer

Step 3 - Create a usage snapshot

Step 4 - Attach snapshot to a property

Once you have completed these 4 steps, you are in a position to generate a comparison report for the associated customer and property combination.


Handling Errors

The Ahiko API returns standard HTTP response codes.
Below are the most common error codes and their reasons:

  • 200 Everything is OK. The response is included in the body.
  • 404 The url does not exist. Check you have entered the url correctly.
  • 403 You 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).

You should treat any response code that is greater than 399 as an error.


Supported Requests

Using your language of choice, make a GET request to the https://api.ahiko.io/customer/v1/customers/{customer_id}/properties 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.

Creating a Comparison - POST

The Ahiko API uses JSON to encode responses. Most languages have libraries to encode and decode JSON.

The API response will look like:

{
  "success": true,
  "data": {
    "insight_comparison_id": "comparison_saga_c05adbea-c4b3-48c3-b3f7-647a7f898488"
  }
}

Whilst generating the comparisons is fast, we don't want you to wait for the response. The design is for the calling client to then use the provided **insight_comparison_id** to subsequently query for the data.

Getting a Comparison - GET

Used to obtain the details comparison insights. The key parameter required is:

  • insight_comparison_id : string The unique identifier of comparison request