Wednesday, December 14, 2011

HTTP Status Codes

The HTTP standard has an extensive list of status codes for server result messages. These are the ones you’ll encounter the most:

200 OK. The request was completed successfully. The body of the message will contain the result of the successful request.

301 Moved permanently. The requested has been permanently moved, and this and all future requests for the resource should be sent to the new location.

303 See other. For this request, the result can be found by doing a GET on a different URL. The URL can be found in the Location header of the message. This is generally used for the result of PUT requests, where after the PUT was successfully processed, the server tells the client where to look to see the result of the operation.

401 Unauthorized. The request was valid, but the user has not provided any authentication data to show that he or she should be permitted to see the resource. The user could use some other request to get an authentication code and then retry the request.

403 Forbidden. The request was valid, but the user is not allowed to access the specified resource. This is similar to 401 but indicates that either the user has been authenticated and still can’t access the resource or that even if the user was authenticated, that user is not permitted to access it.

404 Not found. No resource was found at the specified location.

500 Internal Server Error. Any error in the server during its processing of the request will end up generating a 500 error. In particular, for App Engine services that you implement, the client browser will receive a 500 when your request handlers crash and/or throw an exception.

501 Not implemented. The request wants to perform some operation that the server doesn’t support. You’ll see this most often if you do something like misspell the URL in a POST request.

Source of Information : Pragmatic - Code in the Cloud Programming Google App Engine 2011

No comments: