查询状态报告
POST URL https://api.liasmart.com/api/GetDeliveryStatus
参数说明
参数名称 | 必选项 | 参数描述 | 举例 |
api_id | 是 | Email或者用户后台中提示的APIID | API43404236 |
---|---|---|---|
api_password | 是 | Email或者用户后台中提示的API密码 | Password |
message_id | 是 | 提交发送时系统返回的message_id | 4134 |
API举例
GET请求
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.liasmart.com/api/GetDeliveryStatus?api_id=API4623444906&api_password=password@123&message_id=4134');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://api.liasmart.com/api/GetDeliveryStatus?api_id=API4623444906&api_password=password@123&message_id=4134")
.method("GET", null)
.build();
Response response = client.newCall(request).execute();
curl --location --request GET 'https://api.liasmart.com/api/GetDeliveryStatus?api_id=API4623444906&api_password=password@123&message_id=4134'
import http.client
conn = http.client.HTTPSConnection("api.liasmart.com")
payload = ''
headers = {}
conn.request("GET", "/api/GetDeliveryStatus?api_id=API4623444906&api_password=password@123&message_id=4134", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
POST请求
<?php
$url = "https://api.liasmart.com/api/GetDeliveryStatus";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Accept: */*",
"Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<<DATA
{
"api_id":"API307186906",
"api_password":"abcdefghijk",
"message_id":"4134"
}
DATA;
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$resp = curl_exec($curl);
curl_close($curl);
var_dump($resp);
?>
var url = "https://api.liasmart.com/api/GetDeliveryStatus";
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("Accept", "*/*");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}};
var data = `{
"api_id":"API307186906",
"api_password":"abcdefghijk",
"message_id":"4134"
}`;
xhr.send(data);
#!/bin/bash
curl -X POST https://api.liasmart.com/api/GetDeliveryStatus -H "Accept: */*" -H "Content-Type: application/json" --data-binary @- <<DATA
{
"api_id":"API307186906",
"api_password":"abcdefghijk",
"message_id":"4134"
}
DATA
import requests
from requests.structures import CaseInsensitiveDict
url = "https://api.liasmart.com/api/GetDeliveryStatus"
headers = CaseInsensitiveDict()
headers["Accept"] = "*/*"
headers["Content-Type"] = "application/json"
data = """
{
"api_id":"API307186906",
"api_password":"abcdefghijk",
"message_id":"4134"
}
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
GET和POS的响应
{
"message_id": 4134,
"PhoneNumber": "8613333333333",
"SMSMessage": "Test Message",
"MessageType": "Default",
"MessageLength": 159,
"MessageParts": 1,
"ClientCost": 1,
"DLRStatus": "Delivered",
"SMSID": "9cbd20a1-0cd8-420e-b384-5767b7df7a87",
"ErrorCode": 0,
"ErrorDescription": "000",
"SentDateUTC": "2019-01-01T11:11:39.523",
"remarks":"OK"
}
{
"message_id": 4134,
"PhoneNumber": "8613333333333",
"SMSMessage": "Test Message",
"MessageType": "Default",
"MessageLength": 159,
"MessageParts": 1,
"ClientCost": 1,
"DLRStatus": "Delivered",
"SMSID": "9cbd20a1-0cd8-420e-b384-5767b7df7a87",
"ErrorCode": 0,
"ErrorDescription": "000",
"SentDateUTC": "2019-01-01T11:11:39.523",
"remarks":"OK"
}
{
"message_id": 4134,
"PhoneNumber": "8613333333333",
"SMSMessage": "Test Message",
"MessageType": "Default",
"MessageLength": 159,
"MessageParts": 1,
"ClientCost": 1,
"DLRStatus": "Delivered",
"SMSID": "9cbd20a1-0cd8-420e-b384-5767b7df7a87",
"ErrorCode": 0,
"ErrorDescription": "000",
"SentDateUTC": "2019-01-01T11:11:39.523",
"remarks":"OK"
}
{
"message_id": 4134,
"PhoneNumber": "8613333333333",
"SMSMessage": "Test Message",
"MessageType": "Default",
"MessageLength": 159,
"MessageParts": 1,
"ClientCost": 1,
"DLRStatus": "Delivered",
"SMSID": "9cbd20a1-0cd8-420e-b384-5767b7df7a87",
"ErrorCode": 0,
"ErrorDescription": "000",
"SentDateUTC": "2019-01-01T11:11:39.523",
"remarks":"OK"
}
响应参数说明
参数名称 | 说明 |
message_id | Message ID of the request |
---|---|
PhoneNumber | Phone Number to which message was sent |
SMSMessage | Text of the SMS message |
MessageType | Message Encoding |
MessageLength | Length of Message |
MessageParts | No of Message parts |
ClientCost | Amount Deducted from account |
DLRStatus | Delivery Status Can Be One Of the following 1. Pending 2. Delivered 3. Undeliverable 4. Acknowledged 5. Expired 6. Accepted 7. Rejected 8. Unknown 9. Failed 10. DND |
SMSID | Carrier Generated SMS ID |
ErrorCode | Error Code If Any |
ErrorDescription | Error Description If Any |
SentDateUTC | SMS Sent Date Time in UTC (Universal Time Coordinate) |
Remarks | Remarks for the Request |