20 ms·
Question about your first point - doesn't it depend on the use case? What would happen if I wanted to get a list of datasets and papers? (maybe in this case it
by NeutronBoy 10y ago
Question about your first point - doesn't it depend on the use case?
What would happen if I wanted to get a list of datasets and papers? (maybe in this case it's nonsensical, but it's a problem with some other APIs I've used and I've never figured a good way to work around it)
GET /apiv2/entries?cat=5&cat=6 vs 2 separate requests and client logic to combine results?
- WhitneyLand 10y ago1) Does all this depend on use case? Yes, heavily. Best practices are needed, but final design choices are tailored. 2) I don't like dup query params, it's not well defined: http://stackoverflow.com/questions/1746507/authoritative-position-of-duplicate-http-get-query-keys http://stackoverflow.com/questions/1746507/authoritative-pos... For returning multiple types at once there are a few common strategies. For related types some APIs offer an "include" or "embed" approach like this: http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api#autoloading http://www.vinaysahni.com/best-practices-for-a-pragmatic-res... Another approach is to support a query syntax for items, where items is a container record for multiple possible types. If a certain multi-type scenario super common you may want build the concept into the API itself as basic functionality. Again, your final choice should be as simple as possible but no simpler, taking into account ease of use, performance, etc.
- Senji 10y agoGET /apiv2/entries?cat=datasets+papers