Visual FoxPro
Visual FoxPro
Clickatell Get Message Status
See more Clickatell Examples
This API method will return the status of the given message ID.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcStatus_example
lnSuccess = 0
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
* Implements the following CURL command:
* curl -X GET --header 'Accept: application/json' \
* --header 'Authorization: API_KEY' \
* https://platform.clickatell.com/public-client/message/status?messageId=MESSAGE_ID
loHttp.SetRequestHeader("Authorization","API_KEY")
loHttp.SetRequestHeader("Accept","application/json")
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
lnSuccess = loHttp.QuickGetSb("https://platform.clickatell.com/public-client/message/status?messageId=MESSAGE_ID",loSbResponseBody)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loSbResponseBody
CANCEL
ENDIF
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loHttp.LastHeader
? "Failed."
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "status example": "QUEUED"
* }
* Sample code for parsing the JSON response...
* Use the following online tool to generate parsing code from sample JSON:
* Generate Parsing Code from JSON
lcStatus_example = loJResp.StringOf("status example")
RELEASE loHttp
RELEASE loSbResponseBody
RELEASE loJResp