Hi guys,
I need to create my simple report based on JSON Rest API.

We can use this example to explain my requirement:
https://jsonplaceholder.typicode.com/posts

I’d like to create a pie graph in order to show how many items there are for each user Id.

The REST API returns a list of all data. I need to apply an group by on the data.

What is the best practice?

Thanks

Hello luk3tt0!

Welcome to the Redash community!

Solution that I’ve not tested myself but should work:

  1. Import your JSON Rest API thanks to the JSON Redash Integration
  2. Configure the Query Results Data Source
  3. In a new query, Query Results Data source selected, query your JSON with SQLite. You should be able to apply a group by.

Hope this helps!

Thanks @edouardjmn. I already completed 1 and 2 but 3 I don’t know how works.

Could you please help me?

Thanks in advance for your support

Edouard actually linked the documentation in his post. Have you tried the example there?

Yes, I created JSON data Source, I created a query using uri and filter. I generated a simple table. That’s all ok.

I don’t know how can I group by my data using SQLite as you said.

I would write something like this:

select userId, count(*) as postCount
from query_42
group by userId

Replace 42 by the id of your base JSON query

1 Like

Thanks @edouardjmn. It work. I did’t know “Query Results Data source”.

Your support was greatly appreciated

1 Like