Method HttpClient():getStatusCode() Foundation

Returns the HTTP status code of the last operation.

Syntax
 
:getStatusCode() --> nStatusCode
Return

:getStatusCode() returns a numeric value with the HTTP status code. The value -1 denotes an internal error not handled on the protocol-level. In this case, there is no HTTP status code.

Description

The method :getStatusCode() returns the HTTP status code. This is a status code established on the protocol-level, that is, based on the connection between the client and the server. Errors occuring outside the protocol stack, for example, operating system errors due to resource issues, are reflected using the special status code -1. In this case, the methods :getLastError() and :getLastMessage() can be used for getting more information about the error.

The following table lists the status codes which are most commonly used.

HTTP status codes
Status Code Description
200 OK: The request has succeeded.
403 Forbidden: The request was understood but not authorized by the server.
404 Not Found: The server cannot find the requested resource.
500 Internal Server Error: The server encountered an error. Request was cancelled.
503 Service Unavailable: The server is not ready to handle the request.
-1 Operating system or other non-protocol error

For more details see RFC 7231, section Response Status Codes.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.