HttpPostJson - cJsonHttpTransfer
Executes an HTTP POST 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. 0 if no JSON request data. |
| ByRef bOk | Boolean | Returns true if the request as successful. |
Syntax
Function HttpPostJson String sHost String sFilePath Handle hoJsonRequest ByRef Boolean bOk Returns Handle
Call Example
Get HttpPostJson sHost sFilePath hoJsonRequest bOk to HandleVariable
Description
The HttpPostJson performs a request using the POST HTTP verb. It performs the actual operation by calling the HttpVerbJson function.
Get HttpPostJson of oJsonHttp "jsonplaceholder.typicode.com" ("/customer/" + sId) hoJsonRequest (&bOk) to hoJson
If (bOk) Begin
Send ShowInfoBox "Successfully edited 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 JSON data is returned.