API errors and media-types
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
Given that you have a specific media-type(s) for giving extended API errors e.g. application/vnd.andrei.error-v1+json, application/vnd.andrei.error-v2+json which of the following do you find natural? #1 Be specific about which error media-type(s) you can accept GET http://.../resource Accept: application/vnd.andrei.some-media-type-v1+json, application/vnd.andrei.error-v1+json => 409 CONFLICT Content-Type: application/vnd.andrei.error-v1+json #2 If the client lacks specification of an error media-type, assume that it can process the lowest/highest version GET http://.../resource Accept: application/vnd.andrei.some-media-type-v1+json => 409 CONFLICT Content-Type: application/vnd.andrei.error-v2+json #3 If the client lacks specification of an error media-type, do not return any media-type nor payload - just the HTTP status code GET http://.../resource Accept: application/vnd.andrei.some-media-type-v1+json => 409 CONFLICT The thing is that for #1 and #3 to take place, basho's webmachine for instance would have to do content-negotiation again, but only for the media-types defined as error media-types and without throwing a 415 MEDIA TYPE NOT SUPPORTED. Thank you for your time Andrei NB. I've posted the above and some more comments also at https://groups.google.com/forum/?hl=en&fromgroups#!topic/api-craft/7c4unolo8Rw and I'd want to pick your brain as well