These instructions provide a shortcut to finding the API call you need by harnessing the Cloudability GUI to build the report. Once you've built the report you want, you can use the Javascript Console to collect the API call.
Open Cloudability in Chrome.
Build the report you want in either Cost or Usage Analytics. For example, this one which gives you Instance Name, OS, and Utilization Hours.
Open up the Chrome Javascript Console
Mac: View > Developer > Javascript Console
PC: Tools > JavaScript Console (or Ctrl + Shift + J if you prefer a keyboard shortcut)
Click the Settings Gear Icon.
Enable "Log XMLHttpRequests"
Go to the Console tab of the Javascript Console.
Refresh your Cloudability report.
Now every time you run a report with the console open you can see the XHR requests that are being called.
You'll always see groups of two requests to the API the first is generally the report API call and the second is the chart API call.
Below is a sample API call, be sure to enable API access and insert your token from the Preferences page.
https://app.cloudability.com/api/1/reporting/cost/run.json?auth_token=APITOKEN&start_date=1st&end_date=23%3A59%3A59&dimensions=linked_account_name&metrics=invoiced_cost&sort_by=invoiced_cost&order=desc&title=Linked%20Accounts%20MTD&category=Trends&id=1821&saveable=false&shared=true&owned_by_user=true&custom=true
Change run.json in the URL to run.csv to get a CSV of the report.
If the report you are requesting is large you may want to consider making an asynchronous request.
The Cloudability API Documentation provides much more detail on structuring API calls.
0 Comments