Skip to content

HttpGet - cHttpClient

Include: Use System\Http.pkg

Sends a GET request and keeps the response body in memory.

Type: Function

Return data type: HttpStatus, which is an alias for UShort

Parameters

Parameter Type Description
sPath String Relative path resolved against psEndpoint, or absolute http:///https:// URL.

Syntax

Function HttpGet String sPath Returns HttpStatus

Call

Get HttpGet of hoObj "/get" to eStatus

Description

Sends GET. It has no request body. The response body is normally available through HttpResponseBody and HttpResponseBodyUC. GET is safe, idempotent, cacheable, and allowed in HTML forms.

Example

Handle hoObj
HttpStatus eStatus
String sBody sContentType
UChar[] ucBody
tHttpHeader[] aResponseHeaders

Get Create (RefClass(cHttpClient)) to hoObj
Set psEndpoint of hoObj to C_HTTP_ENDPOINT
Set HttpHeader of hoObj to "Demo" "Value"
Get HttpGet of hoObj "/get" to eStatus
Get HttpResponseBody of hoObj to sBody
Get HttpResponseBodyUC of hoObj to ucBody
Get HttpResponseHeaders of hoObj to aResponseHeaders
Get HttpResponseContentType of hoObj to sContentType
Send Destroy of hoObj