HttpGetJson - cJsonHttpTransfer
Executes an HTTP GET request using JSON data
Type: Function
Return Data Type: Handle
Parameters
| Parameter | Type | Description |
|---|---|---|
| sHost | String | The URL host (e.g. DataAccess.com - Note: DO NOT include the "HTTP://") |
| sFilePath | String | The file path and any data passed in a query string (e.g. MyJsonSite/JsonSrvc.asp?ID=A) |
| ByRef bOk | Boolean | Returns True if the request as successful |
Syntax
Function HttpGetJson String sHost String sFilePath ByRef Boolean bOk Returns Handle
Call Example
Get HttpGetJson sHost sFilePath bOk to HandleVariable
Description
The HttpGetJson performs a request using the GET HTTP verb. It performs the actual operation by calling the HttpVerbJson function.
Get HttpGetJson of oJsonHttp "jsonplaceholder.typicode.com" ("/customer/" + sId) (&bOk) to hoJson
If (bOk) Begin
Send ShowInfoBox "Successfully got the item."
Function_Return hoJson
End
Else Begin
Get TransferErrorDescription of oJsonHttp to sErr
Send UserError sErr "Transfer failed!"
End
The JSON data passed and returned as UTF-8 data, which is what would be expected for JSON transfers over HTTP.
When a JSON response object is returned, it must be destroyed when it is no longer needed.
Return Value
The JSON response passed as a cJsonObject object. 0 if no data is returned, which would be unusual.