import com.chinaums.open.api.OpenApiCache;
import com.chinaums.open.api.OpenApiContext;
import com.chinaums.open.api.constants.ConfigBean;
import com.chinaums.open.api.internal.util.http.HttpTransport;
import java.util.UUID;
public class OpenApiSdkTest {
public static void main(String[] args) throws Exception{
String url = "/v1/selfserviceterminal/devicestatus/monitor ";
//开发者ID
String appId = "平台分配";
//开发者秘钥
String appKey = "平台分配";
//实例化客户端
ConfigBean configBean = new ConfigBean();
OpenApiContext context = new OpenApiContext();
String request = "{\"merId\":\"\",
\"termId\":\"\"}";
context.setStartTime(System.currentTimeMillis());
context.setRequestId(UUID.randomUUID().toString().replace("-", ""));
context.setOpenServUrl(url.split("/v")[0].concat("/"));
context.setApiServiceUrl(url);
context.setVersion(url.split("/")[3]);
context.setAppId(appId);
context.setAppKey(appKey);
context.setConfigBean(configBean);
context.setServiceCode(url.split("/v")[1].substring(1));
OpenApiCache.getCurrentToken(context);
System.out.println(HttpTransport.getInstance().doPost(context, request));
}
}
<?php
require_once "../utils/Log.php";
require_once "../utils/Tools.php";
require_once "../DefaultOpenApiClient.php";
class DataRequest
{
public $url = "";
public $serviceCode = "";
public $apiVersion ="";
public $needToken = true;
public $needDataTag = false;
public $data;
function __construct($data, $url)
{
$this->data = $data;
$apiVersion = preg_split("/[/]+/s",$url)[2];
$this->apiVersion = $apiVersion;
$serviceCode = strstr($url,$apiVersion);
$this->url = strstr($url,"/".$apiVersion,true);
$this->serviceCode = preg_replace("/^" . preg_quote($apiVersion, "/") . "/", "", $serviceCode);
}
}
class DataDemo{
public function main(){
$appid = "平台分配";
$appkey = "平台分配";
$url = "/v1/selfserviceterminal/devicestatus/monitor ";
$data = json_encode(array("merId"=>"",
"termId"=>""));
$reqiest = new DataRequest($data,$url);
$client = new DefaultOpenApiClient();
$content = $client->execute($reqiest,$appid,$appkey);
$obj = json_decode($content);
print_r($obj->errCode);
print_r($obj->errInfo);
}
}
$p = new DataDemo();
$p->main();
?>
# -*- coding: utf-8 -*-
from webapi.DefaultOpenApiClient import DefaultOpenApiClient
url = "/v1/selfserviceterminal/devicestatus/monitor "
class DataRequest(object):
def __init__(self, data: dict) -> dict:
self.data = data
self.serviceCode = url[len(url.split("/v")[0])+len(url.split("/")[3])+1: len(url)]
self.apiVersion = url.split("/")[3]
self.needToken = True
self.needDataTag = True
appId="平台分配"
appKey="平台分配"
client = DefaultOpenApiClient(appId, appKey)
cls = DataRequest({\"merId\":\"\",
\"termId\":\"\"})
response = client.execute(cls)
print(str(response.get("data")))
print(response.get("errCode"))
print(response.get("errInfo"))
print(response.get("resultCode"))
print(response.get("resultInfo"))
状态监控查询
URL
- 生产环境:
POST
https://api-mop.chinaums.com/v1/selfserviceterminal/devicestatus/monitor
描述:状态监控查询当前设备状态。
ContentType:application/json
请求头
名称 | 必填 | 描述 | 示例值 |
---|---|---|---|
Authorization | 是 | 认证内容 | OPEN-BODY-SIG AppId="****",Timestamp="20170606135700",Nonce="99930a147f5353dd8a8f29a5329f37e9",Signature="IPmdGHYCcfN+mto0/02zkwoUF1NT3YqPKaUykMaec1T=" |
请求参数
名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
merId | string | 是 | - | 商户ID | |
termId | string | 是 | - | 终端ID |
响应示例
{
"TERM_NO":"",
"FID":"",
"MID":"",
"SERIAL_NO":"",
"MASTER_VER":"",
"SERVICE_VER":"",
"APP_VER":"",
"TOTAL_STATUS":"",
"PRINTER_STATUS":"",
"RECEIPT_PRINTER_STATUS":"",
"CARD_STATE":"",
"OC_STATUS":"",
"INS_STATUS":"",
"MAC_STATUS":"",
"HE_STATUS":"",
"WP_TATUS":"",
"WP_CNT":"0",
"RC_CNT":0,
"BOX1_STAT":"",
"BOX1_CUR":"",
"BOX1_PAR":"",
"BOX1_CNT":"0",
"BOX2_STAT":"",
"BOX2_CUR":"",
"BOX2_PAR":"",
"BOX2_CNT":"0",
"BOX3_STAT":"",
"BOX3_CUR":"",
"BOX3_PAR":"",
"BOX3_CNT":"0",
"BOX4_STAT":"",
"BOX4_CUR":"",
"BOX4_PAR":"",
"BOX4_CNT":"0",
"ALARM":"",
"COMM_STATUS":"",
"GPS":"",
"IC_STATUS":"",
"NC_STATUS":"",
"LOCK_STATUS":"",
"LAST_MONITOR_TIME":"",
"MONITOR_TIME":"",
"CREATE_TIME":""
}
响应参数
名称 | 类型 | 必填 | 最大长度 | 描述 | 示例值 |
---|---|---|---|---|---|
TERM_NO | string | 是 | 64 | ||
FID | string | 是 | 64 | ||
MID | string | 是 | 64 | ||
SERIAL_NO | string | 是 | 64 | ||
MASTER_VER | string | 是 | 64 | ||
SERVICE_VER | string | 是 | 64 | ||
APP_VER | string | 是 | 64 | ||
TOTAL_STATUS | string | 是 | 64 | ||
PRINTER_STATUS | string | 是 | 64 | ||
RECEIPT_PRINTER_STATUS | string | 是 | 64 | ||
CARD_STATE | string | 是 | 64 | ||
OC_STATUS | string | 是 | 64 | ||
INS_STATUS | string | 是 | 64 | ||
MAC_STATUS | string | 是 | 64 | ||
HE_STATUS | string | 是 | 64 | ||
WP_TATUS | string | 是 | 64 | ||
WP_CNT | number | 是 | 64 | 0 | |
RC_CNT | number | 是 | 64 | ||
BOX1_STAT | string | 是 | 64 | ||
BOX1_CUR | string | 是 | 64 | ||
BOX1_PAR | string | 是 | 64 | ||
BOX1_CNT | number | 是 | 64 | 0 | |
BOX2_STAT | string | 是 | 64 | ||
BOX2_CUR | string | 是 | 64 | ||
BOX2_PAR | string | 是 | 64 | ||
BOX2_CNT | number | 是 | 64 | 0 | |
BOX3_STAT | string | 是 | 64 | ||
BOX3_CUR | string | 是 | 64 | ||
BOX3_PAR | string | 是 | 64 | ||
BOX3_CNT | number | 是 | 64 | 0 | |
BOX4_STAT | string | 是 | 64 | ||
BOX4_CUR | string | 是 | 64 | ||
BOX4_PAR | string | 是 | 64 | ||
BOX4_CNT | number | 是 | 64 | 0 | |
ALARM | string | 是 | 64 | ||
COMM_STATUS | string | 是 | 64 | ||
GPS | string | 是 | 64 | ||
IC_STATUS | string | 是 | 64 | ||
NC_STATUS | string | 是 | 64 | ||
LOCK_STATUS | string | 是 | 64 | ||
LAST_MONITOR_TIME | string | 是 | 64 | ||
MONITOR_TIME | string | 是 | 64 | ||
CREATE_TIME | string | 是 | 64 |