(Visual FoxPro) HTTP DELETE with Body
Demonstrates how to send a DELETE request with a body. Note: This example requires Chilkat v11.0.0 or greater.
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcRequestBody
LOCAL loResp
lnSuccess = 0
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
* Use the HttpStr method (or HttpSb) to send a DELETE request with a body.
lcRequestBody = '{ "abc": 123 }'
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpStr("DELETE","https://example.com/something",lcRequestBody,"utf-8","application/json",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loResp
CANCEL
ENDIF
? "Response status: " + STR(loResp.StatusCode)
? "Response body: "
? loResp.BodyStr
RELEASE loHttp
RELEASE loResp
|