IBM Cloudability

 View Only

 Get dashboard data through API

Jump to  Best Answer
  • Cloudability
Pedro Martins's profile image
Pedro Martins posted Wed December 14, 2022 07:36 AM
Hi.

I was asked to retrieve the same data someone have on her dashboard through API. I have looked all end points and I couldn't find how to retrieve these data.

Is there an API end point for that? If not, is there a chance to create one?
#Cloudability
Greg Winfield's profile image
Greg Winfield  Best Answer
i see. 
in your other thread you were querying the rightsizing API ; it looks like you have solved for it. 
does that work and this query doesn't work because its to a different API?

import requests
import json

url = "https://api.cloudability.com/v3/rightsizing/aws/recommendations/ec2?basis=on-demand&duration=ten-day&filters=recommendations.defaultsOrder%3D%3D1&limit=25&maxRecsPerResource=1&offset=0&product=ec2&sort=-recommendations.savings&vendorAccountIds&viewId=0"

payload = ""
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Basic yourAPIkeyfromCldy'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)​

hoping this will help?


#Cloudability
Jenny Franklin's profile image
Jenny Franklin

Is this a dashboard within Apptio or another system?  For reports/dashboards within Apptio, you can right-click and get the Show API URL like this...


#Cloudability
Pedro Martins's profile image
Pedro Martins
The dashboard is in Cloudability, but there is no right-click menu like that, at least for MacOS. Tried on Chrome and Safari.
#Cloudability
Jenny Franklin's profile image
Jenny Franklin
My apologies - the coffee isn't kicking in this morning - didn't see this was in the Cloudability space.  Will check internal channels and see what I can find - thanks!
#Cloudability
Jenny Franklin's profile image
Jenny Franklin

Found this in the Help area - let me know if this doesn't do the trick? 

https://help.apptio.com/en-us/cloudability/api/v3/getting_started_with_the_cloudability.htm


#Cloudability
Pedro Martins's profile image
Pedro Martins
I have tried several endpoints and I couldn't find any that return data for an existing dashboard. Maybe a new endpoint could be created for that. What I can do is to try to get all data in several endpoints to see if I could retrieve the same data.
#Cloudability
Jeff Hyatt's profile image
Jeff Hyatt
Since dashboards are essentially collections of potentially very diverse reports and metrics, not sure how you'd manage that with a single call. So your approach to use multiple calls seems like the way to go - one for each widget (report). You could simplify that by creating a report (api call) that combines data from multiple widgets, if they are related.
#Cloudability
Greg Winfield's profile image
Greg Winfield
@Pedro Martins hey

I often use Developer tools to format my API calls ; in Chrome on Windows Control Shift I will get you there, on a Mac Command Shift I.
Refresh the page and look in the Network tab to see the individual API calls that are made.
From there use your API key to then make the same calls back into the API.

This can be used in a multitude of areas of Cldy as the platform is built on API calls :)​
#Cloudability
Pedro Martins's profile image
Pedro Martins

@Greg Winfield

I have followed your tip and I have got the URL for the table that I need. However, when I put it into code it is returning 401 :/


#Cloudability
Greg Winfield's profile image
Greg Winfield
Pedro are you getting your API key from within the Cloudability tool mate? (Manage Profile, Preferences)

What tool are you using to make the API call?
If you're using CURL make sure you have a colon on the end of your key between the single quotes.
https://help.apptio.com/en-us/cloudability/api/v3/getting_started_with_the_cloudability.htm

If another tool ensure Basic is selected as the auth type and that the key is in the user name field.

#Cloudability
Pedro Martins's profile image
Pedro Martins
@Greg Winfield, yes, ​​I am correctly getting API key. Please look this thread until the end.
#Cloudability
Greg Winfield's profile image
Greg Winfield
also ; can you give me the API call you are trying to reach ; i'd like to try it to ; to see if 1) i can replicate the same behaviour and 2) see if i can help you here.
#Cloudability