Endpoint Styles: Simplification & Minimalization #11
jacob-a-brown
started this conversation in
General
Replies: 3 comments
|
This isn't just applicable to locations & things, but can also be used for observation endpoints, like |
0 replies
|
A disadvantage could be that the user expects the same endpoint to always return data in the same format, so by allowing them to specify and change the format they may make mistakes or have mistaken assumptions. |
0 replies
|
I agree. Mimicking good parts of other services is always a good idea. See PR 39 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Rather than have a number of different endpoints that essentially serve the same data (for
GETrequests), it may be simpler to implement a single endpoint that can return that data in a variety of different formats. This will make it easier to understand the API because a user won't have to go to different endpoints to obtain the same data (though in different formats). Other services, like Geoconnex and USGS' water data services, have this implemented and are good proofs of concept.Why is this easier for the user?
The same query can be reused to obtain the same data, but in different formats (such as
?format=geojsonor?format=shapefile).Why is this easier for the developer?
The same logic can be used to obtain the same data, and then at the end of the endpoint function a series of if/else statements can be used to serve the data in the desired format.
e.g.
Challenges
Thoughts?
All reactions