Sample code for 30+ languages & platforms
Lianja

Clickatell Get Message Status

See more Clickatell Examples

This API method will return the status of the given message ID.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loHttp = createobject("CkHttp")

// 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("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://platform.clickatell.com/public-client/message/status?messageId=MESSAGE_ID",loSbResponseBody)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbResponseBody
    return
endif

loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.

? "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
    return
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