3 ms·
I don't think it's search because the server must provide a response for each resource or an error. If one resource is missing the server should return an error
by themihai 10y ago
I don't think it's search because the server must provide a response for each resource or an error. If one resource is missing the server should return an error.
---
Concerning the post I would move it to `ask HN` but I don't know how to do that. Perhaps I need more karma?
- niftich 10y agoIf you need separate responses for each resource, why not make separate requests in the first place? - OR - You can design a structured format that communicates the information you want. For example, a format based on JSON with an array of objects, or a format based on JSON with an key-value map of objects (ie. object of objects).
- themihai 10y agoWell that's exactly what I need: A format that communicates structured data, friendly with GET requests and backward compatible with query string encoding. Why there is no such format/standard yet? Is it that unusual?
- niftich 10y agoThere are ready-made mediatypes to communicate collections; some have even been registered as mediatypes with IANA. A simple one that would meet your needs is Collection+JSON [1]. There are others. This blog post [2] from 2014 lists some from a hypermedia perspective, although you may find some of these formats excessive for what you're trying to accomplish. Before JSON became a favorite for HTTP APIs, there used to be XML-based ones as well. AtomPub is a very good protocol, which defines an 'application/atomcoll+xml' mediatype for collections [3] [1] http://amundsen.com/media-types/collection/ http://amundsen.com/media-types/collection/ [2] http://sookocheff.com/post/api/on-choosing-a-hypermedia-format/ http://sookocheff.com/post/api/on-choosing-a-hypermedia-form... [3] http://bitworking.org/projects/atom/draft-ietf-atompub-protocol-04.html#collection_resource http://bitworking.org/projects/atom/draft-ietf-atompub-proto...