Skip to content

HttpPutJson - cJsonHttpTransfer

Executes an HTTP PUT 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)
hoJsonRequest Handle The JSON request passed as a cJsonObject object. Pass 0 if none.
ByRef bOk Boolean Returns true if the request as successful.

Syntax

Function HttpPutJson String sHost String sFilePath Handle hoJsonRequest ByRef Boolean bOk Returns Handle

Call Example

Get HttpPutJson sHost sFilePath hoJsonRequest bOk to HandleVariable

Description

The HttpPutJson performs a request using the PUT HTTP verb. It performs the actual operation by calling the HttpVerbJson function.

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

If (bOk) Begin
    Send ShowInfoBox "Successfully edited the item."
    If (hoJson) Begin
        Send Destroy of hoJson
    End
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 is usual for a PUT.