The
restResponse type is used to define all the advanced characteristics of a REST response. The characteristics of the request can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see
Declaring a variable.
cMyRequest is httpRequest
cMyRequest.URL = "http://www.windev.com"
cMyResponse is httpResponse = RESTSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse.Content)
END
Remarks
Properties specific to the description of restResponse variables
The following properties can be used to handle the response of a REST request:
| | |
Property name | Type used | Effect |
---|
Content | Buffer | Body of server response. This property is read-only. |
ContentType | Character string | String: Type of content for the received HTTP message. This property is read-only. |
DescriptionStatusCode | Character string | Description of the StatusCode property. This property is read-only. |
Header | Associative array of character strings | Key/Value set of received headers. |
RoughHeader | Character string | Header that was returned with the response. This property is read-only. |
StatusCode | Integer | Status of response. This property corresponds to one of the codes of HTTP protocol. The most common codes are: - 200: Request successfully processed
- 301: Document moved permanently
- 302: Document moved temporarily
- 403: The server understood the request but it refuses to run it.
- 404: Resource not found
- 500: Internal server error
- 503: Service temporarily unavailable or in maintenance
The DescriptionStatusCode property gets the description of the error code. This property is read-only. |