Solved

Chart ID for Dashboard API into python notebook?

  • 31 January 2024
  • 2 replies
  • 47 views

I am looking to grab data from a chart into a Python Notebook

 

I have followed the instructions here: https://www.docs.developers.amplitude.com/analytics/apis/dashboard-rest-api/#get-results-from-an-existing-chart

import requests

url = "https://amplitude.com/api/3/chart/:chart_id/query"

payload={}
auth=requests.auth.HTTPBasicAuth('api-key', 'secret-key')

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

print(response.text)

However, I keep getting URL not found.

I have the api-key and secret-key.

 

I believe the line of code where there is the issue is the second line.

The URL where chart resides is :

https://app.amplitude.com/analytics/[CompanyName]/chart/at54vy8p

Could someone help me with what should this line of code be:

url = "https://amplitude.com/api/3/chart/:chart_id/query"

I have tried following options without success:

url = "https://amplitude.com/api/3/chart/:at54vy8p/query" 
url = "https://amplitude.com/api/3/chart/at54vy8p/query" 
url = "https://amplitude.com/analytics/[Company Name]/api/3/chart/:at54vy8p/query" 
url = "https://amplitude.com/analytics/[Company Name]/api/3/chart/at54vy8p/query" 

Any help is much appreciated.

icon

Best answer by Saish Redkar 31 January 2024, 19:37

View original

2 replies

Userlevel 7
Badge +10

Hi @srahman 

You can omit the company name from your chart url while querying.

So use url = "https://amplitude.com/api/3/chart/at54vy8p/query" 

Hope this helps.
 

Thank you so much!

Reply