TheIOFoundation / ProjectLockdown

Project Lockdown (an initiative from The IO Foundation) is a civic tech, interactive platform providing an overview of the state of Human and Digital Rights around the globe. It evaluates policies obtained from official sources that may impact their observance. It provides, among other tools, a layered map interface that allows for a visual representation of the policies adopted, assisting a broad range of stakeholders in understanding the global state of their Rights. This empowers them to become active agents of global change.
https://ProjectLockdown.world
GNU General Public License v3.0
36 stars 14 forks source link

API: Different response formats #9

Open JFQueralt opened 4 years ago

JFQueralt commented 4 years ago

logo

❕ Problem description

Currently, our Open Data API offers only responses in JSON format. This may not be the most adequate format for data analysis in certain scenarios.

To offer better, standard formats to extract the RAW data from Project Lockdown.

💡 Proposed solution

For each public endpoint, (see documentation ), there should be an option to provide format to the API request parameters, in order to obtain the following formats:

See Format documentation below for details on each format.

Definition of Done

📚 Resources

Project documentation

API Technical documentation

Format documentation

maingockien01 commented 3 years ago

@jeff-knurek I think we should provide different response content type for a number of selected API endpoints? I think CSV is really efficient with only 2D table data. For some endpoint like Environment, it's not really efficient to use CSV. Turn Environment response object to CSV is kind of awkward. My idea is we will select a list of available content type for each endpoints. JSON will be default available for all endpoint. If users want different format, they need to add it in request header.

jeff-knurek commented 3 years ago

good point. @JFQueralt what do you think? it seems like endpoints like /environment are just for MAP, and wouldn't ever need to be anything but json. maybe it's only in some variation of the reports (#162) that we need different response formats?

jeff-knurek commented 3 years ago

@maingockien01 after quick discussion with @JFQueralt there is just a few endpoints that will use CSV format as output:

Also: the other 2 format types (XLS, HXL) aren't required for these endpoints either


After @YehualashetGit 's PR for DSL endpoint is merged, you can already have a go at trying to implement that one to return the list in CSV format