vendredi 3 août 2018

Restful url design that involves multiple resources

I am building a small frontend that calls external API to get a list of events and also to get report on a given event.

I have an url such as, /events which shows a list of events. Each events has button or link to following urls:

/events/:id > displays some info on a given event /events/:id/report > displays various details of the event. The report has some table and charts. By default it will show report on current date. /events/:id/report?startdate=...&enddate=... > Same report as above but for the selected date range.

Now I need to add another option for comparing multiple events. For example see a combined report of multiple events. See same chart for multiple events as single event report.

What is the best way to habdle the url for this comparing option?

/events/:id/reportCompare?id=2;5 > This is an example of comparing 3 events. Compare current event with event id 2 and 5. But this seems odd and doesn't quite make sense.

/events/compare?id=1;2;5 > This is probably ok but the base url, /events/compare, has nothing to show.

/compare/?id=1;2;5 > Has same concern as the previous one. Plus it seems odd to suddenly switch from /events to /compare

I searched for similar questions but didn't find anything that answered my question.

Aucun commentaire:

Enregistrer un commentaire