Message Status

Query your MT SMS's current status via moceansms API Server at Base URL

Response will be given for every request in XML format by default. In fact, you get to choose between XML or JSON format by setting value for optional parameter "mocean-resp-format" and submit along your query.

HTTP Method Supported

GET - moceansms API Server only reads data from HTTP URL

URL

https://rest-api.moceansms.com/rest/1/report/message

Parameters

Parameter Name

Data Format

Descriptions

mocean-api-key

* Required

string

Your account API key.

mocean-api-secret

* Required

string

Your account API secret.

mocean-msgid

* Required

string

Message ID associated with the transaction which given during SMS submission.

mocean-resp-format

* Optional

string

Response format. By default, response format will be returned in XML. Supported formats are:

  1. XML
  2. JSON

Example Request

curl -X GET "https://rest-api.moceansms.com/rest/1/report/message?mocean-api-key={api_key}&mocean-api-secret={api_secret}&mocean-msgid={message_id}"
$url = 'https://rest-api.moceansms.com/rest/1/report/message?' . http_build_query(
[
'mocean-api-key' => 'API_KEY',
'mocean-api-secret' => 'API_SECRET',
'mocean-msgid' => 'MESSAGE_ID',
]
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

Example Response

A successful response for message status query will be as follows:

<result>
    <status>0</status>
    <message_status>1</message_status>
    <msgid>cust20013050311050614001</msgid>
    <credit_deducted>1</credit_deducted>
</result>

<result>
    <status>0</status>
    <message_status>2</message_status>
    <msgid>cust20013050311050614001</msgid>
    <credit_deducted>1</credit_deducted>
    <message_error_code>3</message_error_code>
</result>
{
    "status":0,
    "message_status":1,
    "msgid":"cust20013050311050614001",
    "credit_deducted":"1"
}

{
    "status":0,
    "message_status":2,
    "msgid":"cust20013050311050614001",
    "credit_deducted":"1",
    "message_error_code":3
}

While unsuccessful response will be as follows:

<result>
    <status>1</status>
    <err_msg>Authorization failed</err_msg>
</result>
{
  "status":1,
  "err_msg":"Authorization failed"
}

Message Status Response Variables

Parameter Name

Data Format

Descriptions

status

number

Status of the request.

msgid

string

Message id submitted by user.

message_status

number

Status of the message id.

message_error_code

string

Error code for the corresponding message id if message status for the submitted message id is failed. This error code corresponding to MT-SMS Response Status Codes.

credit_deducted

number

Amount of credit deducted for transaction.

err_msg

string

Error message corresponding to the error code.

Message Status Response Status Codes

Status Code

Descriptions

0

OK. No error encountered

1

Authorization failed. Invalid mocean-api-key or mocean-api-secret.

24

Unknown error.

25

Invalid msgid

32

Throttled. Too many queries sent in.

Message Status Codes

Message Status

Descriptions

1

Transaction success.

2

Transaction failed.

3

Transaction failed due to message expired.

4

Transaction pending for final status.

5

Transaction not found.