注册成功回调
POST URL https://api.liasmart.com/api/CTrack
参数说明
参数名称 | 必选项 | 参数描述 | 举例 |
api_id | 是 | Email或者用户后台中提示的APIID | API43404236 |
---|---|---|---|
api_password | 是 | Email或者用户后台中提示的API密码 | Password |
message_id | 是 | 提交发送时系统返回的message_id | 4134 |
status | 是 | 注册成功填写true | true |
API举例
GET请求
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.liasmart.com/api/CheckBalance?api_id=API4623444906&api_password=password@123&message_id=4134&status=true');
$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/CheckBalance?api_id=API4623444906&api_password=password@123&message_id=4134&status=true")
.method("GET", null)
.build();
Response response = client.newCall(request).execute();
curl --location --request GET 'https://api.liasmart.com/api/CheckBalance?api_id=API4623444906&api_password=password@123&message_id=4134&status=true'
import http.client
conn = http.client.HTTPSConnection("api.liasmart.com")
payload = ''
headers = {}
conn.request("GET", "/api/CheckBalance?api_id=API4623444906&api_password=password@123&message_id=4134&status=true", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
POST请求
<?php
$url = "https://api.liasmart.com/api/CheckBalance";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Content-Type: application/json",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$data = <<<DATA
{
"api_id":"YourApiId",
"api_password":"YourApiPassword",
"message_id":"4134",
"status":"true"
}
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/CheckBalance";
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
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":"YourApiId",
"api_password":"YourApiPassword",
"message_id":"4134",
"status":"true"
}`;
xhr.send(data);
#!/bin/bash
curl -X POST https://api.liasmart.com/api/CheckBalance -H "Content-Type: application/json" --data-binary @- <<DATA
{
"api_id":"YourApiId",
"api_password":"YourApiPassword",
"message_id":"4134",
"status":"true"
}
DATA
import requests
from requests.structures import CaseInsensitiveDict
url = "https://api.liasmart.com/api/CheckBalance"
headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/json"
data = """
{
"api_id":"YourApiId",
"api_password":"YourApiPassword",
"message_id":"4134",
"status":"true"
}
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
GET和POS的响应
{
"ErrorCode":1000
"ErrorDescription": "OK"
}
{
"ErrorCode":1000
"ErrorDescription": "OK"
}
{
"ErrorCode":1000
"ErrorDescription": "OK"
}
{
"ErrorCode":1000
"ErrorDescription": "OK"
}
响应参数说明
参数名称 | 说明 |
ErrorCode | 1000~1009 |
---|---|
ErrorDescription | ErrorCode = 1000; ErrorDescription = "OK" ErrorCode = 1001; ErrorDescription = "api_id not specified"; ErrorCode = 1002; ErrorDescription = "api_password not specified"; ErrorCode = 1003; ErrorDescription = "Invalid api_id"; ErrorCode = 1004; ErrorDescription = "Invalid api_password"; ErrorCode = 1005; ErrorDescription = "status not specified"; ErrorCode = 1006; ErrorDescription = "Invalid status"; ErrorCode = 1007; ErrorDescription = "message_id not specified"; ErrorCode = 1008; ErrorDescription = "Invalid message_id"; ErrorCode = 1009; ErrorDescription = "message_id already updated"; |