Where can I see the API in action?
The Analytics API has been implemented into your Developer Console for ease of access if you do not wish to make use of the API itself. However, all functionality shown in the Developer Console and more is available to you with the API.
Below is an example of the Analytics API integrated into your Developer Console. This allows those with access to the workspace to see statistics on the Product of their choice (PhoneCheck, SubscriberCheck, or SIMCheck), with the layout of their choice (Hourly, Daily, or Monthly), and over the time period of their choice.
Below the Analytics graph in the Developer Console, you’ll find a table outputting a little more information on the breakdown of the statistics of the PhoneCheck. This is grouped by Project, and outputs one of 4 possible results for each project:
- COMPLETED (Phone number is a match)
- COMPLETED (Phone number is not a match)
- EXPIRED (The unique check URL was triggered but never completed)
- ERROR (This could be because the Mobile Network Operator (MNO) is not supported, or the device is not on a mobile IP address)
How can I use the API?
The Analytics API can be found under the API specifications within the tru.ID Developer Documentation Portal.
There are three separate endpoints for this API. Each endpoint has the same parameters available to them. The last part of the endpoint URL specifies which one you wish to use:
- Hourly (`/hourly`)
- Daily (`/daily`)
- Monthly (`/monthly`)
An example Analytics request is shown in the URL below. This checks for monthly Analytics on PhoneCheck (`pck`), where `match` is true, and the results are grouped by `project_id`.
Accessing Analytics API via CLI
The Analytics API can be also accessed from the tru.ID Command Line Interface. The detailed overview can be found under the Command Line Interface (CLI) Reference within the tru.ID Developer Documentation Portal.
Similarly to the API, to access the analytics data, there are two parameters — a product and a time bucket — that need to be specified after the `analytics:` command’s prefix:
- PRODUCT = `pck | sck |suk`
- TIME-BUCKET = `hourly | daily | monthly`
An example of accessing analytics from the tru.ID CLI is shown in the command below. This checks for monthly Analytics on PhoneCheck (`pck`), where `match` is true, and the results are grouped by `project_id`.
That’s all you need to know to get started with the Analytics API and start analysing your tru.ID data effectively.
If you have any questions, feel free to contact firstname.lastname@example.org or get involved in our dedicated Slack group.