Reports API Overview
Programmatically obtain cost, usage, and savings information for your cloud infrastructure with easy to use RESTful API.
DoiT Cloud Analytics Reports give you instant visibility into your Google Cloud or AWS costs without having to spend agonizing hours scanning through vendor's bills. With Cloud Analytics Reports, you can slice and dice your cloud spend and shine a light on cost & performance optimization opportunities for your organization.
The Reports API lets you programmatically obtain your Google Cloud and Amazon Web Services cost, usage, and savings information with a simple, yet powerful RESTful API.
API Reference
The Invoices API reference is available at https://developer.doit.com/reference/idofreports
Required Permissions
Cloud Analytics (part of Standard User built-in role)
The Reports API has the following methods:
reports.list
The reports.list method lists all reports accessible by your user account, according to the report's access control list (ACL) as described under the Share Cloud Analytics Reports section.
You can filter the list by using one or more of the following parameters.
Parameter | Description |
---|---|
minCreationTime | string Min value for a report's creation time, in milliseconds since the POSIX epoch. If set, only reports created after or at this timestamp are returned." |
maxCreationTime | string Max value for a report's creation time, in milliseconds since the POSIX epoch. If set, only reports created before or at this timestamp are returned." |
filter | string An expression for filtering the results of the request. The syntax is key:[<value>] . For example, the type:custom will filter the list to the only custom reports.Supported filter keys: - type (can be custom or preset )- owner (e.g. [email protected] )- lastModified (in milliseconds since epoch)Learn more about how to use filter *.list requests |
Sample Request:
curl --location \
--request GET 'https://api.doit.com/analytics/v1/reports?maxResults=10' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data-raw ''
your-api-key
Always replace "your-api-key" with your actual API key as explained at Getting Started
Sample Response:
{
"pageToken": "1",
"reports": [
{
"id": "9DHZq53WOd1qFSDoFvx5",
"reportName": "Compute Committed Use Coverage [N1]",
"owner": "doit.com",
"type": "preset",
"lastModified": 1599404375000,
"urlUI": "https://app.doit.com/customers/eefz2TQFjKhtz29mvzGp/analytics/reports/9DHZq53WOd1qFSDoFvx5"
},
{
"id": "T36M3b1cuCtxhGW6FbfJ",
"reportName": "Monthly Credits History 12mo",
"owner": "doit.com",
"type": "preset",
"lastModified": 1593378000000,
"urlUI": "https://app.doit.com/customers/eefz2TQFjKhtz29mvzGp/analytics/reports/T36M3b1cuCtxhGW6FbfJ"
},
{
"id": "eHyeIVike2U8hMzlEeRd",
"reportName": "Cloud SQL CUD Eligible Consumption",
"owner": "doit.com",
"type": "preset",
"lastModified": 1593378000000,
"urlUI": "https://app.doit.com/customers/eefz2TQFjKhtz29mvzGp/analytics/reports/eHyeIVike2U8hMzlEeRd"
}
]
}
reports.get
The reports.get method provides access to the results of a Cloud Analytics Report.
Sample Request:
curl --location \
--request GET 'https://api.doit.com/analytics/v1/reports/Am8kcTIToEvR12vy3l45' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your-api-key' \
--data-raw ''
your-api-key
Always replace "your-api-key" with your actual API key as explained at Getting Started
Sample Response:
{
"id": "ttwTNnZNnKfUb1SZvabc",
"reportName": "Cost By Region",
"owner": "doit.com",
"type": "preset",
"lastModified": 1636302545000,
"urlUI": "https://app.doit.com/customers/ImoC9XkrutBysJvyqabc/analytics/reports/ttwTNnZNnKfUb1SZvabc",
"result": {
"schema": [
{
"name": "region",
"type": "string"
},
{
"name": "year",
"type": "string"
},
{
"name": "month",
"type": "string"
},
{
"name": "cost",
"type": "float"
},
{
"name": "timestamp",
"type": "timestamp"
}
],
"rows": [
[
"af-south-1",
"2022",
"08",
4.77887545676,
1659312000
],
[
"ap-east-1",
"2022",
"08",
123.81523334947846,
1659312000
],
[
"ap-northeast-1",
"2022",
"08",
4.528845611653599,
1659312000
],
[
"ap-south-1",
"2022",
"08",
20.22909362781385,
1659312000
],
[
"ap-southeast-1",
"2022",
"08",
68.79021476856339,
1659312000
],
[
"ap-southeast-2",
"2022",
"08",
28.863405885237803,
1659312000
],
[
"ca-central-1",
"2022",
"08",
12.879249772013996,
1659312000
],
[
"eu-central-1",
"2022",
"08",
47.26199278150188,
1659312000
],
[
"eu-west-1",
"2022",
"08",
1143.2235788861128,
1659312000
],
[
"eu-west-2",
"2022",
"08",
168.6103843522694,
1659312000
],
[
"global",
"2022",
"08",
184.5222996689999,
1659312000
],
[
"me-south-1",
"2022",
"08",
3.122681566177,
1659312000
],
[
"sa-east-1",
"2022",
"08",
326.07178067309394,
1659312000
],
[
"us-east-1",
"2022",
"08",
16331.370670908636,
1659312000
],
[
"us-east-2",
"2022",
"08",
1.16831038671307,
1659312000
],
[
"us-west-1",
"2022",
"08",
544.3572504326701,
1659312000
],
[
"us-west-2",
"2022",
"08",
858.8736917317524,
1659312000
]
]
}
}
Response Body
If successful, the response body contains an instance of Report
{
"id": String,
"reportName": String,
"owner": String,
"type": Enum,
"lastModified": String,
"urlUI": String,
"result": {
"schema": Array,
"rows": Array,
"ml_features": Array
}
}
Response fields:
Field | Description |
---|---|
id | string The Id of the report |
reportName | string The name of the report |
owner | String The person who owns the report |
lastModified | String Last update date of the report (Epoc time) |
result | Object schema - JSON object represnting the Rows valuesRows - The report values* ml_features - The data related to ML features set on the report, for example: Trending Up |
Experimental feature
You can pass an optional
timeRange
URL parameter to override the time range of the report. You can either specify a period or startDate/endDate pair.Examples:
- https://api.doit.com/analytics/v1/reports/{{report-id}}&timeRange=P20D
- https://api.doit.com/analytics/v1/reports/{{report-id}}&startDate=2022-08-15&endDate=2022-09-03
To specify a period, please use P[n]Y[n]M[n]D notation, where Y is the year(s), M is the month(s), and D is the day(s). For example, P28D means the last 28 days, and P1Y means the last year.
Updated 3 months ago