Atria API
Purpose
The Atria API is a new Rest-based integration point that over time will replace the functionality of the old API, (known as the CortexAPI). If you have developed against The CortexAPI, don’t worry, it’s still working and supported.
Requirements:
-
Atria 12.11 or higher
-
A valid Atria external API Token
Benefits
The new API will be easier for developers to understand and consume and will be built using standard conventions.
Our initial release is focused on Billing, the API can be used to extract your billing information directly into spreadsheets, PowerBI, or third-party systems.
Using the API
Authentication
Authentication to the API uses a JWT token, the application communicating with Atria, presents the token, this is then validated against a user in Atria, if valid access is permitted and the API call is executed.
Tokens are created within Atria and are attached to a user account.
If the user account in Atria is disabled, then API access via the token attached to that user will also be disabled. Note that the user account must be disabled via Atria in order to disable API access, disabling the associated AD user account will not immediately block access.
At the time of writing, AD Account expiry will not disable API access.
Authorization
In order for a user to have an API token, they must be granted the “
Service Provider Developer
” permission. Once they have this permission, the change password page allows the tokens to be created and deleted.
In order to grant "Service Provider Developer" permission to a user follow the below steps:
-
Click on Users -> select a user -> Edit User -> Account Settings -> Advanced Options -> Enable "Service Provider Developer" check-box
Creating a Token
Once you leave this page, you will not be able to view the token again, it is encrypted and stored in the database, if you forget the token you will need to create another one and reconfigure your applications.
Store the token securely and protect it in the same way as credentials.
Using the Token
The token should be provided as an Authorization header for every call made to the API. If the token is not present the API call will fail.
Header name
|
Value
|
Authorization
|
|
Billing API Calls
Billing Parameters
/api/Billing/parameters
This
GET
command will return
-
All of the billing periods that are available within your Atria system
-
All of the Customers contained within the system and their customerIDs
Curl Syntax
-
curl -X GET "https://{API HOSTNAME}/api/Billing/parameters" -H "accept: text/plain" -H "Authorization: bearer a8cab2d1ae00df4a7edd514af7828d7df672054c89feb753305f17c403127769"
-
{
-
"data": {
-
"endDates": [
-
{
-
"label": "2019-10-31"
-
},
-
{
-
"label": "2019-11-30"
-
},
-
{
-
"label": "2019-12-31"
-
},
-
{
-
"label": "2020-01-31"
-
},
-
{
-
"label": "2020-02-29"
-
},
-
],
-
"customers": [
-
{
-
"id": 30,
-
"name": "Aanimals Inc"
-
},
-
{
-
"id": 102,
-
"name": "Abacus Computing Group"
-
},
-
{
-
"id": 57,
-
"name": "Able Metals Limited"
-
},
-
{
-
"id": 5,
-
"name": "Abracard Limited"
-
}
-
]
Curl Syntax (Powershell)
-
curl -Uri "https://{API HOSTNAME}/api/Billing/parameters" -Method Get -Headers @{
-
accept = "text/plain"
-
authorization = "bearer a8cab2d1ae00df4a7edd514af7828d7df672054c89feb753305f17c403127769"
-
}
Billing Summary
URL - /api/billing/{enddate}
-
This extracts a summarized view of the data for a billing period (as specified by the billing period end date), this refers to a customer, but does not provide detailed information for the customer (e.g. address details etc)
-
You can specify whether you want to retrieve only billable items (set billable flag).
-
Group output by customer with the AggregateByCustomer parameter.
-
This will also compare the data from the current period with the prior period, so handy for showing trends in data.
Header Name
|
Description
|
endDate * (string, path)
|
The end date of the billing period
|
customerId (integer, query)
|
The customer to generate a billing summary for
|
billable (integer, query)
|
Whether to only include billable items
|
aggregateByCustomer (boolean, query)
|
Whether to aggregate the results by customers
|
Example JSON Response
-
{
-
"data": {
-
"items": [
-
{
-
"customerCode": "string",
-
"customerName": "string",
-
"customerAccountCode": "string",
-
"sku": "string",
-
"isBillable": true,
-
"lineDescription": "string",
-
"previousPeriod": 0,
-
"change": 0,
-
"currentPeriod": 0
-
}
-
],
-
"billPeriodId": 0,
-
"periodName": "string",
-
"startDate": "2023-10-23T12:47:24.683Z",
-
"endDate": "2023-10-23T12:47:24.683Z"
-
},
-
"errorMessage": "string",
-
"success": true,
-
"responseCode": 0
-
}
Get a detailed report of all customer data
Using the EndDate from previous, or input the current month in your code, you can pull a detailed report
URL - /api/billing/{enddate}/detail
This extracts user level details for the specified billing period. For example, data will show the customer, the user, the service and the duration of the month that they have had the service (via start and end date)
Filter the data to a specific customer, show billable or all data, or use additional parameters for service and user search.
Header Name |
Description |
endDate * (string, path) |
The end date of the billing period |
customerId (integer, query) |
The customer to generate a billing summary for |
serviceSearch (string, query) |
Search for a specific service |
userSearch (string, query) |
Search for a specific user |
billable (integer, query) |
Whether to only include billable items |
Example JSON Response
-
{
-
"data": {
-
"items": [
-
{
-
"billPeriodID": 0,
-
"periodName": "string",
-
"billPeriodStartDate": "2023-10-23T12:51:24.148Z",
-
"billPeriodEndDate": "2023-10-23T12:51:24.148Z",
-
"customerId": 0,
-
"customerCode": "string",
-
"customerName": "string",
-
"customerAccountCode": "string",
-
"address1": "string",
-
"address2": "string",
-
"country": "string",
-
"postCode": "string",
-
"email": "string",
-
"billCustomerID": 0,
-
"billCustomerCode": "string",
-
"billCustomerName": "string",
-
"billCustomerAccountCode": "string",
-
"billAddress1": "string",
-
"billAddress2": "string",
-
"billCountry": "string",
-
"billPostCode": "string",
-
"billEmail": "string",
-
"billItemID": 0,
-
"serviceChangeID": 0,
-
"userId": 0,
-
"upn": "string",
-
"userName": "string",
-
"serviceId": 0,
-
"serviceCode": "string",
-
"serviceName": "string",
-
"instanceName": "string",
-
"sku": "string",
-
"skuType": "string",
-
"planCode": "string",
-
"servicePlanName": "string",
-
"lineDescription": "string",
-
"summaryGrouping": "string",
-
"percentDuration": 0,
-
"isBillable": true,
-
"overrideReason": "string",
-
"billConfigRuleID": 0,
-
"changeStartDate": "2023-10-23T12:51:24.148Z",
-
"changeEndDate": "2023-10-23T12:51:24.148Z",
-
"quantity": 0,
-
"action": "string",
-
"addedByUserID": 0,
-
"addedByUserName": "string",
-
"removedByUserID": 0,
-
"removedByUserName": "string",
-
"department": "string",
-
"location": "string",
-
"actionedDate": "2023-10-23T12:51:24.148Z",
-
"actionedBy": "string",
-
"resultCount": 0
-
}
-
],
-
"billPeriodId": 0,
-
"periodName": "string",
-
"startDate": "2023-10-23T12:51:24.148Z",
-
"endDate": "2023-10-23T12:51:24.148Z"
-
},
-
"errorMessage": "string",
-
"success": true,
-
"responseCode": 0
-
}