Blog

Harnessing The Power of Cloud Analytics With Our New API: reports.query()

cloud-analytics-reports-query-api-DoiT

As we continue to innovate and grow, one thing remains constant — our commitment to making life easier for developers. We understand the complexities of managing cloud services, and that’s why we’re excited to announce a brand new feature in our analytics arsenal — the reports.query() API call.

This new functionality is designed to empower you to generate Cloud Analytics reports programmatically, allowing you to fetch and analyze report data via a single API call. It’s like having an on-demand analyst in your pocket!

Why You’ll Love reports.query()

Imagine you’re running applications on both Google Cloud Platform (GCP) and Amazon Web Services (AWS). You want to understand your recent spending on specific services like AWS EC2 or GCP BigQuery over the last week. Ordinarily, that would involve considerable time spent digging through separate dashboards or interfaces to collate the data.

With our  reports.query() API, this process becomes significantly simpler. Let's look at an example API call:

 

curl --request POST \
     --url https://api.doit.com/analytics/v1/reports/query \
     --header 'Authorization: Bearer {{your-api-key}}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "group": [
    {
      "id": "service_description",
      "type": "fixed"
    }
  ],
  "timeRange": {
    "unit": "day",
    "amount": 7,
    "includeCurrent": false,
    "mode": "last"
  },
  "timeInterval": "day"
}
'

With this simple request, you can generate a comprehensive expenditure report across multiple services over the past week.

Here’s a brief breakdown of the request:

  •  group : This specifies the grouping of the report data. In this case, we're grouping by  service_description . You can programmatically get the full list of available dimensions using dimensions.list() API method
  • timeRange : This specifies the time range for the report. In the example, we're asking for data from the last seven days.
  • timeInterval : This sets the interval for time-based aggregation of the report data. Here, we're setting it to daily aggregation.

Here is what the data you get back from the API can look like. I am only posting a small part of the response for convenience.

 

{
  "Result": {
    "schema": [
      {
        "name": "service_description",
        "type": "string"
      },
      {
        "name": "year",
        "type": "string"
      },
      {
        "name": "month",
        "type": "string"
      },
      {
        "name": "day",
        "type": "string"
      },
      {
        "name": "cost",
        "type": "float"
      },
      {
        "name": "timestamp",
        "type": "timestamp"
      }
    ],
    "rows": [
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "06",
        1.5757174094000006,
        1688601600
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "07",
        1.3773117481,
        1688688000
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "08",
        1.3947479550999997,
        1688774400
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "09",
        1.4486706111999998,
        1688860800
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "10",
        1.3961570165000001,
        1688947200
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "11",
        1.4235074821999998,
        1689033600
      ],
      [
        "AWS CloudTrail",
        "2023",
        "07",
        "12",
        1.4268483946000001,
        1689120000
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "06",
        0.07,
        1688601600
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "07",
        0.07,
        1688688000
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "08",
        0.07,
        1688774400
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "09",
        0.08,
        1688860800
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "10",
        0.07,
        1688947200
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "11",
        0.06999999999999999,
        1689033600
      ],
      [
        "AWS Cost Explorer",
        "2023",
        "07",
        "12",
        0.07,
        1689120000
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "06",
        0.09677419200000002,
        1688601600
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "07",
        0.09677419200000002,
        1688688000
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "08",
        0.09677419200000002,
        1688774400
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "09",
        0.09677419200000002,
        1688860800
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "10",
        0.09677419200000004,
        1688947200
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "11",
        0.09677419200000002,
        1689033600
      ],
      [
        "AWS Data Pipeline",
        "2023",
        "07",
        "12",
        0.09677419200000002,
        1689120000
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "06",
        1.4365837167000002,
        1688601600
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "07",
        1.4837915334,
        1688688000
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "08",
        1.4360271,
        1688774400
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "09",
        1.4397221999,
        1688860800
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "10",
        1.4407052167000003,
        1688947200
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "11",
        1.4418464164,
        1689033600
      ],
      [
        "AWS Directory Service",
        "2023",
        "07",
        "12",
        1.4447365167000001,
        1689120000
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "06",
        0,
        1688601600
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "07",
        0,
        1688688000
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "08",
        0,
        1688774400
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "09",
        0,
        1688860800
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "10",
        0,
        1688947200
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "11",
        0,
        1689033600
      ],
      [
        "AWS Glue",
        "2023",
        "07",
        "12",
        0,
        1689120000
      ],
      [
        "AWS Key Management Service",
        "2023",
        "07",
        "06",
        0.09687619200000003,
        1688601600
      ],
      [
        "AWS Key Management Service",
        "2023",
        "07",
        "07",
        0.09687619200000003,
        1688688000
      ],
      [
        "AWS Key Management Service",
        "2023",
        "07",
        "08",
        0.09687619200000003,
        1688774400
      ],
      [
        "reCAPTCHA Enterprise",
        "2023",
        "07",
        "12",
        0,
        1689120000
      ]
    ]
  }
}

Of course, your actual report could be much more complex than in my example. For example, you could group your cost, usage and even some custom metrics by multiple dimensions (such as “cloud,” “service,” “labels,” or even your own attributions such as “team,” “app”, etc.) and at the same time to filter certain data out of the report.

A Powerful Tool for Enhanced Decision-Making

The new  reports.query() API provides you with a way to quickly generate analytics reports programmatically, enabling you to tap into key insights with ease and speed. It's all about having the right information at your fingertips, empowering you to make better, more informed decisions.

You can now monitor your cloud costs, track the performance of various services, and understand usage patterns, all without leaving your development environment.

Start Using reports.query() Today

If you’re as excited about this new feature as we are, grab your API key and start today. Feel free to experiment, and don’t hesitate to contact us if you have any questions or feedback. We’re always here to help and are eager to see the innovative ways you’ll leverage the  reports.query()  API to optimize and inform your cloud strategy.

You can review the full API spec at the DoiT Platform Developer Center at https://developer.doit.com/reference/query

Are you ready to take your cloud cost analytics to the next level?

 

Subscribe to updates, news and more.

Leave a Reply

Your email address will not be published. Required fields are marked *

Related blogs

Schedule a call with our team

You will receive a calendar invite to the email address provided below for a 15-minute call with one of our team members to discuss your needs.

You will be presented with date and time options on the next step