HTTP status code when single request asks for too large resource or too many of them

403 sounds like the most appropriate choice. It basically says “nu-uh. You don’t get to see that.”, which is pretty much the case here. 10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. […] Of course, it’d be a … Read more

Should the PATCH method return all fields of the resource in the response body?

Normally this should be handled through content negotiation. In other words, the client asks for a specific representation if it needs one. The request would look like this: PATCH /user/123 Content-Type: application/merge-patch+json Accept: application/vnd.company.user+json … In this case, the client expresses that it wants a full user representation as answer. Or it could do: PATCH … Read more

best approach to design a rest web service with binary data to be consumed from the browser

My research results: Single request (data included) The request contains metadata. The data is a property of metadata and encoded (for example: Base64). Pros: transactional everytime valid (no missing metadata or data) Cons: encoding makes the request very large Examples: Twitter GitHub Imgur Single request (multipart) The request contains one or more parts with metadata … Read more

How to create a custom media type (application/vnd) for a RESTful web service?

@JohnDoDo One first question: Does the media type define the contract between my server and client? Yes, media type is one part of the contract. Contract in REST API is not static unlike SOAP(i.e. WSDL). Contract is defined by combination of underlying protocol(i.e. HTTP), URIs and Media Types(it’s not prohibited to use several media types … Read more