Skip to content

HttpVerbJson - cJsonHttpTransfer

Executes an HTTP request using JSON data for the passed verb

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)
hoJsonRequest Handle The JSON request passed as a cJsonObject object. Pass 0 if none.
sVerb String An HTTP verb of your choosing
ByRef bOk Boolean Returns True if the request as successful.

Syntax

Function HttpVerbJson String sHost String sFilePath Handle hoJsonRequest String sVerb ByRef Boolean bOk Returns Handle

Call Example

Get HttpVerbJson sHost sFilePath hoJsonRequest sVerb bOk to HandleVariable

Description

The HttpVerbJson performs a request using the passed HTTP verb.

All of the other Http JSON request methods calls this method. Those are HttpDeleteJson, HttpGetJson, HttpPatchJson, HttpPostJson and HttpPutJson. Normally, you will use one those methods.

Get HttpVerbJson of oJsonHttp "jsonplaceholder.typicode.com" ("/customer/" + sId) hoJsonRequest "GET" (&bOk) to hoJson

If (bOk) Begin
    Send ShowInfoBox "Successfully did whatever."
    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.