Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Http.PostJson3 to Http.HttpJson

Provides instructions for replacing deprecated PostJson3 method calls with HttpJson.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcContentType
LOCAL loJson
LOCAL loResponseObj
LOCAL loResponseOut

lnSuccess = 0

loHttp = CreateObject('Chilkat.Http')

lcUrl = "https://example.com/something"
lcContentType = "application/json"
loJson = CreateObject('Chilkat.JsonObject')
loJson.LoadFile("C:/temp/requestBody.json")

* ------------------------------------------------------------------------
* The PostJson3 method is deprecated:

loResponseObj = loHttp.PostJson3(lcUrl,lcContentType,loJson)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    CANCEL
ENDIF

* ...
* ...

RELEASE loResponseObj

* ------------------------------------------------------------------------
* Do the equivalent using HttpJson.
* Your application creates a new, empty HttpResponse object which is passed 
* in the last argument and filled upon success.

loResponseOut = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpJson("POST",lcUrl,loJson,lcContentType,loResponseOut)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loResponseOut
    CANCEL
ENDIF

RELEASE loHttp
RELEASE loJson
RELEASE loResponseOut