Skip to main content

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/cCompanyName]/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/yCompany Name]/api/3/chart/:at54vy8p/query" 
url = "https://amplitude.com/analytics/lCompany Name]/api/3/chart/at54vy8p/query" 

Any help is much appreciated.

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