Solved

How to get full chart result without pruning in REST API?


Badge

How to get full chart result without pruning in REST API?

Currently I am using REST API like -

curl -u API_Key:Secret_Key 'https://amplitude.com/api/3/chart/CHART_ID/query'

by passing CHART_ID.

When I am looking at chart table data it is showing full data and even when I am exporting csv data it is returning file with full data. But when I am doing same thing with REST API, it is pruning data and not returning full data.

Can you please help me to get full data without pruning using REST API?

icon

Best answer by belinda.chiu 10 May 2022, 20:25

View original

8 replies

Userlevel 7
Badge +10

Hey @dadasaheb.patil 

There could be a possibility of charts results getting pruned in the Dashboard REST API responses and it may vary depending on the chart type. We sometimes get a prunedResult key in that response, but not sure how that gets set.

@Denis Holmes@Jeremie Gluckman 

Can we understand from the Engineering Team how pruning happens on the REST API responses ? I couldn’t find any mention of pruning in the API docs. This issue was also brought up in another post before. It’d be nice if we can get to know this one in depth.

Userlevel 5
Badge +4

Hi @dadasaheb.patil ! Welcome to the Amplitude Community and I’m happy to help! 

What kind of chart are you trying to download? The Return Existing Chart API aka the query you are using will have responses vary by chart type. For Event Segmentation and Funnel charts, the maximum groupby/row limit is 1000: https://developers.amplitude.com/docs/dashboard-rest-api#:~:text=Full%20description.-,limit%20(optional),Group%20By%20values%20returned%20(default%3A%20100).%20The%20maximum%20limit%20is%201000.,-formula%20(optional%2C%20required

On the other hand, the CSV download has 10K row limit: https://help.amplitude.com/hc/en-us/articles/115002923888#h_23368329-5147-4369-9d91-6a1d552eab36

Due to the row limitation for the API, you may not get all of the data that you expected to get. 

But, if you are exporting an Event Segmentation chart, you can recreate the chart through the Event Segmentation query and change the “limit” parameter to 20K (undocumented): https://developers.amplitude.com/docs/dashboard-rest-api#event-segmentation This increase in the row limit should help you get the data you are looking for given that you got the data you need through the CSV 10K limit. 

Hope this helps! 

Badge

Hi @belinda.chiu ,

Thanks for your quick response.

I am more looking over Breakdown Table where I get data in tabular format, which is more relevant than any type of chart. I am ok with any kind of chart, but need full data without prune for Breakdown Table data shown on UI.

My report condition is simple as below -

 

 

How to get full result for this condition, either using https://amplitude.com/api/3/chart/CHART_ID/query API or https://amplitude.com/api/2/events/segmentation either way is fine.

Userlevel 6
Badge +8

Hi @dadasaheb.patil ,

 

I see Belinda answered your question and as she said

Due to the row limitation for the API, you may not get all of the data that you expected to get. 

This is especially true if there is a lot of results. You can find information on how to build charts API calls here. If you are still having trouble, do let me know the chart URL and I will try to do my best to construct it for you. 

 

Badge

Hi @Denis Holmes ,

Thanks for quick response.

chart URL is https://analytics.amplitude.com/blueshift-labs-inc/chart/196n9qw

query api I tried which has row limitation, Can you please create event segment API request payload for above condition so that I can get same data, at least 20k result which is much better than 1k result. If this works fine, I’ll try for other chart and ask for help if needed.

And is this row limit applicable irrespective of subscription?

I am more interested in Breakdown Table data than actual shown any chart.

Userlevel 6
Badge +8

@dadasaheb.patil ,

 

I went through our Help Center article here and use the API without issue, I would recommend reading through it fully and understanding each of the parameters to help you. 

Regardless, I am using the below chart, the only difference being using specific dates. 

https://analytics.amplitude.com/blueshift-labs-inc/chart/196n9qw/edit/5o2czx0
 

I used Basic Authorization with Postman. I hope this helps. 
 


 

 

Userlevel 7
Badge +10

Thanks for jumping in on this @Denis Holmes@belinda.chiu 

Userlevel 6
Badge +8

@Saish Redkar Anytime! Hope you’re keeping well :D 

Reply