lundi 28 juin 2021

How to design API for reports

Hi and thanks in advance for ideas.

I have an api endpoint to design which is a report of tickets. The report itself needs to accept up to 8-10 parameters like start / end date or start / end product group. The report then is fairly simple ( Van number, product, quantity ) group by van & product The API endpoint should represent a resource ( so it would be tickets ) however that would force the API consumer ( a webpage in this scenario ) to calculate the total quantity on frontend.

So I wonder what is the correct pattern here? Is creating an endpoint for such report wrong way of doing it? Should I create /tickets/vanloading?startDate=2021-06-28&endDate=.........

What is general approach for different kind of reports when implementing API when there is plenty of data to aggregate ?

Thank you.

Aucun commentaire:

Enregistrer un commentaire