Description
Gets the response body into a string or blob value.
Applies to
HTTPClient object
Syntax
objectname.GetResponseBody ( data )
objectname.GetResponseBody ( data, encodingType )
Argument |
Description |
---|---|
objectname |
The name of the HTTPClient object for which you want to get the response body |
data |
A string or blob variable into which the function returns data. The string value with the following encoding is supported:
|
encodingType |
An encoding value specifying the string data: EncodingANSI!, EncodingUTF8!, EncodingUTF16LE!, or EncodingUTF16BE!. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument’s value is null, the method returns null.
Examples
This example gets the response body and converts to a blob value:
HttpClient lnv_HttpClient lnv_HttpClient = Create HttpClient // Send request using GET method li_rc = lnv_HttpClient.SendRequest("GET", "http://demo.appeon.com/PB/webapi_client/employee/102") // Obtain the response message if li_rc = 1 then // Obtain the response status li_StatusCode = lnv_HttpClient.GetResponseStatusCode() if li_StatusCode = 200 then // Obtain the header ls_ContentType = lnv_HttpClient.GetResponseHeader("Content-Type") // Obtain the specifid header // Obtain the response data lnv_HttpClient.GetResponseBody(ls_body) // No encoding is specified, because encoding of the response data is unknown //lnv_HttpClient.GetResponseBody(ls_string, EncodingUTF8!) // Encoding of the response data is known to be EncodingUTF8!. //lnv_HttpClient.GetResponseBody(lblb_blob) // Obtain the response data and convert to a blob ... end if
See also