![]() The client should not repeat the request (without changing credentials). It is also viable to respond with HTTP 404 (Not Found) in these situations if the server wants to hide the resource. The client is authenticated, but does not have the permission to use the given request method on the requested resource. This status code is typically returned if the request does not include required authentication information such as passwords or tokens. For missing authorization HTPP 403 is used. Note that this status code is badly named, it is used to indicate missing authentication not missing authorization. The request lacks credentials and cannot be authenticated. This status code is often returned if server side validation of the request data fails. The client should not repeat the request without modification. The request has been received, but the server is unable to process it due to malformed request syntax. However, 308 indicates that the URI change is permanent and clients should use the updated URI for future requests. The new URI is again given in the Location header. Like 307 this status code is used when the target resource URI has been changed. Temporary Redirect indicates that the client should use the original request URI for future requests. The URI of the target resource has been temporary changed and current URI is given in the response Location header. In case the resource has been modified, the resource should be returned with a status code 200 (OK). 304 is returned with an empty response body to indicate that the resource has not been modified. Such a request has to contain a If-None-Match or If-Modified-Since header. This status code is used for caching purposes when a client issued a conditional GET request. Updated meta-information can be passed in response headers. When sending 204 the response body must be empty. The request succeeded, but there is no content to send for this request. It can also be a good idea to return a reference to a resource where the client can get the current processing status and the result once processing has been finished. ![]() The response should include some indication about the processing status. It is also possible that the request might be disallowed when processing actually takes place. For example, the server might have saved the request, but the processing will be done later by a batch job. The request has been accepted, but the processing has not been completed. If the resource is created later by an asynchronous process, the server should respond with HTTP 202 (Accepted, see below). ![]() Note that the resource must be created before 201 is returned. The Location header field can be used to return the URI(s) of the newly created resource. HTTP 201 is often used after a resource has been created by a POST or PUT request (see REST: Creating resources). The request has succeeded and a new resource has been created. However, other 2xx status code can be more specific in certain situations. HTTP 200 is often used as the default status code to indicate that everything worked as expected. Here is a list of status codes commonly used in web applications and REST APIs. 5xx: Server error, the request has been accepted, but the processing failed due to a server error.4xx: Client error, there was a problem with the request.3xx: Redirection, further action needs to be taken.2xx: Success, the request has been understood and accepted.The first digit of the status-code is used to categorize the response: ![]() These 3-digit integer codes indicate the result of the servers attempt to satisfy the request.
0 Comments
Leave a Reply. |