查询余额
POST URL https://api.liasmart.com/api/CheckBalance
参数说明
参数名称 | 必选项 | 参数描述 | 举例 |
api_id | 是 | Email或者用户后台中提示的APIID | API43404236 |
---|---|---|---|
api_password | 是 | Email或者用户后台中提示的API密码 | Password |
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');
$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")
.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'
import http.client
conn = http.client.HTTPSConnection("api.liasmart.com")
payload = ''
headers = {}
conn.request("GET", "/api/CheckBalance?api_id=API4623444906&api_password=password@123", 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"
}
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"
}`;
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"
}
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"
}
"""
resp = requests.post(url, headers=headers, data=data)
print(resp.status_code)
GET和POS的响应
{
"BalanceAmount": 1270.09,
"CurrenceCode": "USD",
"Message": "OK"
}
{
"BalanceAmount": 1270.09,
"CurrenceCode": "USD",
"Message": "OK"
}
{
"BalanceAmount": 1270.09,
"CurrenceCode": "USD",
"Message": "OK"
}
{
"BalanceAmount": 1270.09,
"CurrenceCode": "USD",
"Message": "OK"
}
响应参数说明
参数名称 | 说明 |
BalanceAmount | 您账户的余额 |
---|---|
CurrenceCode | 余额对应的币种,比如USD,CNY |
Message | 查询结果,OK |