联通物联网卡平台提供了大部分管理能力。以新的“连接管理--蜂窝安全为例”,可以实现订单、设备、短信、通讯计划、账单用量、账户和资费计划管理。具体接口地址如下:
接口名 URL
API轮询APN https://gwapi.10646.cn/api/wsGetPollApn/V1/1Main/vV1.1
API账单查询 https://gwapi.10646.cn/api/wsGetInvoice/V1/1Main/vV1.1
API设备用量查询 https://gwapi.10646.cn/api/wsGetTerminalUsage/V1/1Main/vV1.1
API短信查询 https://gwapi.10646.cn/api/wsQuerySMS/V1/1Main/vV1.1
API短信详情查询 https://gwapi.10646.cn/api/wsQuerySMSDetail/V1/1Main/vV1.1
查询指定设备可用事件资费计划 https://gwapi.10646.cn/api/wsGetAvailableEvents/V1/1Main/vV1.1
API安吉星查询设备实时信息 https://gwapi.10646.cn/api/wsGetDeviceRealTimeInfo/V1/1Main/vV1.1
查询给定日期和时间后发生修改的设备 https://gwapi.10646.cn/api/wsGetModifiedTerminals/V1/1Main/vV1.1
返回一个或多个设备的通信计划 https://gwapi.10646.cn/api/wsGetNetworkAccessconfig/V1/1Main/vV1.1
查询设备最近某种属性的修改结果 https://gwapi.10646.cn/api/wsGetProvisioningStatus/V1/1Main/vV1.1
查询一个或多个设备的当前会话信息 https://gwapi.10646.cn/api/wsGetSessionInfo/V1/1Main/vV1.1
查询一个设备的变更记录详情 https://gwapi.10646.cn/api/wsGetTerminalAuditTrail/V1/1Main/vV1.1
查询指定设备关联的事件资费计划 https://gwapi.10646.cn/api/wsGetTerminalEvents/V1/1Main/vV1.1
返回给定设备的当前基本资费计划和所有排队资费计划 https://gwapi.10646.cn/api/wsGetTerminalRating/V1/1Main/vV1.1
返回与给定的一组设备IMSI对应的ICCID列表 https://gwapi.10646.cn/api/wsGetTerminalsByImsi/V1/1Main/vV1.1
返回与给定的一组设备MSISDN对应的ICCID列表 https://gwapi.10646.cn/api/wsGetTerminalsByMsisdn/V1/1Main/vV1.1
API返回给定设备在一个特定计费周期内发生的所有流量会话的相关信息 https://gwapi.10646.cn/api/wsGetTerminalUsageDataDetails/V1/1Main/vV1.1
API返回一个设备在某个特定计费周期内接到或拨打的所有通话呼叫的相关信息 https://gwapi.10646.cn/api/wsGetTerminalUsageGsmDetails/V1/1Main/vV1.1
API返回一个设备在某个特定计费周期内发出或收到的所有短信的相关信息 https://gwapi.10646.cn/api/wsGetTerminalUsageSmsDetails/V1/1Main/vV1.1
API查询设备最近某种属性的修改结果 https://gwapi.10646.cn/api/wsStatus/V1/1Main/vV1.1
修改迁移卡状态 https://gwapi.10646.cn/api/wsUpdateStatusMigrationSim/V1/1Main/vV1.1
API新建APN https://gwapi.10646.cn/api/wsCreateNewApn/V1/1Main/vV1.1
Japan离线计费APN维护接口 https://gwapi.10646.cn/api/wsUpdateJasperOfflineCharingAPN/V1/1Main/vV1.1
修改订单信息 https://gwapi.10646.cn/api/wsUpdateOrderInfo/V1/1Main/vV1.1
更新订单状态(更新参数) https://gwapi.10646.cn/api/wsUpdateOrderStatus/V1/1Main/vV1.1
API通过SIM卡ID批量发送短信 https://gwapi.10646.cn/api/wsSendBulkSms/V1/1Main/vV1.1
API通过MSISDN批量发送短信 https://gwapi.10646.cn/api/wsSendBulkSmsToMsisdn/V1/1Main/vV1.1
API通过SIM卡ID发送短信 https://gwapi.10646.cn/api/wsSendSms/V1/1Main/vV1.1
API通过MSISDN发送短信 https://gwapi.10646.cn/api/wsSendSmsToMsisdn/V1/1Main/vV1.1
为设备分配事件资费计划 https://gwapi.10646.cn/api/wsActivateTerminalEvent/V1/1Main/vV1.1
向设备队列的开头添加一个资费计划 https://gwapi.10646.cn/api/wsAddPlanInBeginQueue/V1/1Main/vV1.1
向设备队列的末尾添加一个资费计划 https://gwapi.10646.cn/api/wsAddPlanInLastQueue/V1/1Main/vV1.1
为特定设备取消预定事件 https://gwapi.10646.cn/api/wsDeleteTerminalEvent/V1/1Main/vV1.1
更改与给定设备相关联的通信计划 https://gwapi.10646.cn/api/wsEditNetworkAccessConfig/V1/1Main/vV1.1
为给定设备更改单个属性的值 https://gwapi.10646.cn/api/wsEditTerminal/V1/1Main/vV1.1
查询一个或多个设备详情 https://gwapi.10646.cn/api/wsGetTerminalDetails/V1/1Main/vV1.1
从设备队列中删除指定资费计划 https://gwapi.10646.cn/api/wsRemoveRatePlanFromQueue/V1/1Main/vV1.1
强制设备断开网络 https://gwapi.10646.cn/api/wsSendCancelLocation/V1/1Main/vV1.1
更改给定设备IP地址 https://gwapi.10646.cn/api/wsUpdateIpAddress/V1/1Main/vV1.1
API订单新建 https://gwapi.10646.cn/api/wsCreateOrderApi/V1/1Main/vV1.1
API新建或删除 https://gwapi.10646.cn/api/wsInsertOrDeleteAPI/V1/1Main/vV1.1
API查询测试 https://gwapi.10646.cn/api/wsSelectAPI/V1/1Main/vV1.1
编辑账户 https://gwapi.10646.cn/api/wsEditAcct/V1/1Main/vV1.1
新建账户 https://gwapi.10646.cn/api/wsNewAcct/V1/1Main/vV1.1
查询账户详情 https://gwapi.10646.cn/api/wsQueryAcctDet/V1/1Main/vV1.1
查询账户列表 https://gwapi.10646.cn/api/wsQueryAcctTable/V1/1Main/vV1.1
根据账户名查询账户ID https://gwapi.10646.cn/api/wsQueryIdbyName/V1/1Main/vV1.1
根据运营商账户名查询账户ID https://gwapi.10646.cn/api/wsQueryIdbyServiceProCode/V1/1Main/vV1.1
API可用事件资费计划查询 /api/query/eventplan/available/V1/1Main/vV1.1
API关联事件资费计划查询 /api/query/eventplan/terminal/V1/1Main/vV1.1
API分配事件资费计划 /api/operate/eventplan/activate/V1/1Main/vV1.1
API删除事件资费计划 /api/operate/eventplan/delete/V1/1Main/vV1.1
联通蜂窝网络物联网卡平台对接签名,PHP版本的签名算法
token签名,参与签名字段只有app_id timestamp trans_id
物联网卡签名算法描述
1.蜂窝安全API接口时参数分为鉴权参数和业务负载参数,
2.鉴权权参数各个接口相同,包括appid,timestamp,trans_id,token四个参数,
其中app_id为开通API功能时提供给企业用户,timestamp和trans_id的值由用户自行指定,token为签名字段,
其值是根据app_id,timestamp,trans_id三个参数的值,再加上提供给企业客户的app_secret值,四个值经过
加密算法计算得出,具体请参考《能力使用者接入指引 V2.7》中的sdk代码实现
{
"app_id":"XXXXXX",
"timestamp":"2018-12-05 10:23:35 649",
"trans_id":"XXXXXX",
"token":"XXXXXXXXXXXXXXXXXXXXXXXXX",
"data" :{
"messageId": "134536",
"openId": "xxxxxxxxxx",
"version": "1.0",
"iccids":["89860919720022503597"]
}
}
4.data中为业务负载参数,格式参考各个接口的接口文档
php版本的签名算法
//联通蜂窝网络物联网卡平台对接签名 php版本
$appSecret = 'xxxx';
$currentTime = date('Y-m-d H:i:s')." 100";
$transId = date("YmdHis") . "100" . random_int(100000, 999999);
$requestDataCommon = [
'app_id' => 'x1x1x1x1x1',
'timestamp' => $currentTime,
'trans_id' => $transId,
];
//sm3为国密3的加密算法,可以使用找个库 https://github.com/DongyunLee/SM3-PHP
$token = sm3("app_id{$requestDataCommon['app_id']}timestamp{$requestDataCommon['timestamp']}trans_id{$requestDataCommon['trans_id']}{$appSecret}");
我们以查询设备详情为例:一次完成的查询示例
https://gwapi.10646.cn/api/wsGetTerminalDetails/V1/1Main/vV1.1
{
"app_id": "xxxxxx",
"timestamp": "2021-01-06 10:16:27 100",
"trans_id": "20210106101627100982650",
"token": "08a342fe34a830352a3869d2cc3f57ad5c8d391a8cd86633873f7ceafeebdf0b",
"data": {
"openId": "xxxxxx",
"version": "1.0",
"iccids": [
"xxxxxx"
]
}
}
//返回数据
{
"message": "成功",
"status": "0000",
"data": {
"messageId": "210101017722305444",
"resultCode": "0000",
"terminals": [
{
"ratePlan": 21013412,
"dateReceivied": "2020-11-13 15:03:02",
"Customer": null,
"fieldValue6": "",
"monthToDateVoiceUsageMO": "0",
"fieldValue5": "",
"fieldValue4": "",
"fieldValue3": "",
"fieldValue2": "",
"fieldValue1": "",
"deviceId": "xxxxxx",
"dateAdded": "2020-11-13 14:29:31.0",
"iccid": "xxxxxx",
"ctdSessionCount": 0,
"overageLimitOverride": "0",
"customerCustom1": "",
"customerCustom2": "",
"fixedIpAddress": "",
"customerCustom5": "",
"customerCustom3": "",
"fieldValue10": "",
"customerCustom4": "",
"secureSimId": "1",
"accountId": "xxxxxx",
"monthToDateSMSUsageMO": "0",
"monthToDateVoiceUsage": "0",
"simNotes": "",
"operatorAccountId": "xxxxxx",
"monthToDateUsage": "2920.56",
"copyRulePwd": "1",
"modemId": "",
"imsi": "460065017172956",
"operatorCustom2": "",
"monthToDateSMSUsage": "0",
"operatorCustom1": "",
"operatorCustom4": "",
"overageLimitReached": "197010",
"operatorCustom3": "",
"lockStatus": "0",
"dateShipped": "2020-11-13 00:00:00",
"msisdn": "xxxxxx",
"monthToDateDataUsage": "2920.56",
"provinceCusutom1": "",
"dateModified": "2020-12-27 10:01:25.0",
"provinceCusutom4": "",
"realNameStatus": "0",
"operatorCustom5": "",
"provinceCusutom5": "",
"provinceCusutom2": "",
"provinceCusutom3": "",
"fieldValue9": "",
"fieldValue8": "",
"fieldValue7": "",
"imei": "xxxxxx",
"simStatus": "2",
"dateActivated": "2020-12-27 10:01:25"
}
],
"timestamp": "2021-01-06 10:16:36",
"version": "1.0"
}
}
使用curl请求的示例
curl --location --request POST 'https://gwapi.10646.cn/api/wsGetTerminalDetails/V1/1Main/vV1.1'
--header 'Content-Type: text/plain'
--data-raw '{
"app_id": "xxxx",
"timestamp": "2021-01-06 10:16:27 100",
"trans_id": "20210106101627100982650",
"token": "08a342fe34a830352a3869d2cc3f57ad5c8d391a8cd86633873f7ceafeebdf0b",
"data": {
"openId": "xxxxxx",
"version": "1.0",
"iccids": [
"xxxxxx"
]
}
}
群名称:
联通蜂窝物联网卡平台交流
群 号:
916204588
点击链接加入群聊【联通蜂窝物联网卡平台】:https://jq.qq.com/?_wv=1027&k...
Tags: [物联网卡]