Endpoint Styles: Simplification & Minimalization #11
Replies: 3 comments
-
This isn't just applicable to locations & things, but can also be used for observation endpoints, like |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I agree. Mimicking good parts of other services is always a good idea. See PR 39 |
Beta Was this translation helpful? Give feedback.
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
GET
requests), 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=geojson
or?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?
Beta Was this translation helpful? Give feedback.
All reactions