ProjectLockdown
ProjectLockdown copied to clipboard
API: Different response formats

❕ 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:
CSVXLSHXL
See Format documentation below for details on each format.
Definition of Done
- [ ] implemented into each public endpoint
- [ ] default data if not specified is JSON
- [ ] documentation in Stoplight is updated to indicate how this works
- [ ] basic unit tests added to code
- [ ] deployed to production servers
📚 Resources
Project documentation
- General Project considerations: Project Wiki
- Project Architecture: Project Wiki
- Getting Started with PLD APIs: Project Wiki
- Data Lifecycle: Project Wiki
API Technical documentation
Format documentation
@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.
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?
@maingockien01 after quick discussion with @JFQueralt there is just a few endpoints that will use CSV format as output: * DSL List * Territory List * Datapoints List
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