ProjectLockdown icon indicating copy to clipboard operation
ProjectLockdown copied to clipboard

API: Different response formats

Open JFQueralt opened this issue 5 years ago • 3 comments

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:

  • CSV
  • XLS
  • HXL

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

API Technical documentation

  • API reference (includes mock server): Stoplight
  • JSON Models reference (schemas): Stoplight

Format documentation

JFQueralt avatar Oct 03 '20 02:10 JFQueralt

@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.

maingockien01 avatar Jun 28 '21 19:06 maingockien01

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 avatar Jun 30 '21 12:06 jeff-knurek

@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

jeff-knurek avatar Jul 02 '21 14:07 jeff-knurek