1.注册设备
请求URL
请求方式
请求格式
参数
{
"app_id": "",
"app_secret": "",
"device_sn": ""
}
参数名 | 必选 | 类型 | 说明 |
---|
app_id | 是 | string | 用户app_id |
app_secret | 是 | string | 用户app_secret |
device_sn | 是 | string | 设备序列号 |
返回示例
{
"code": 0,
"msg": "注册成功"
}
{
"code": 1005,
"msg": "设备已注册"
}
返回参数说明
参数名 | 类型 | 说明 |
---|
code | int | 错误码 0成功其他异常 |
msg | int | 描述 |
备注
2.播放云语音
接口状态
已完成
接口URL
请求方式
POST
Body-Json
Content-Type
json
请求Body参数
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data":{
"cmd_type":"play",
"info": {
"tts":"您的订单还有15分钟结束,请及时续费,以免断电影响使用,谢谢",
"inner":10,
"volume": 3
}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W70F9766718 | String | 是 | 序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | play | String | 是 | 命令字 |
data.info | - | Object | 是 | 数据信息 |
data.info.tts | 您的订单还有15分钟结束,请及时续费,以免断电影响使用,谢谢 | String | 是 | 要播放的文本 |
data.info.inner | 10 | Integer | 是 | 头部提示音,取值范围1-15 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "play",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应成功 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 序列号 |
data.cmd_type | play | String | 命令类型 |
data.info | - | Object | 数据信息 |
data.info.code | 0 | Integer | 响应代码 |
data.info.msg | - | String | 响应消息 |
3.云喇叭设置
暂无描述
接口状态
已完成
接口URL
https://wdev.wmj.com.cn/deviceApi/send
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data":{
"cmd_type":"setting",
"info": {
"volume":5,
"speed":5,
"tone":5,
"launch_tts":" ",
"speaker":0
}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W71F9783874 | String | 是 | 序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | setting | String | 是 | 命令字 |
data.info | - | Object | 是 | 数据信息 |
data.info.volume | 5 | Integer | 否 | 0-9,音量由小到大,默认为中间值 |
data.info.speed | 5 | Integer | 否 | 0-9,语速由慢到快,默认为中间值正常语速 |
data.info.tone | 5 | Integer | 否 | 0-9,语调由低到高,默认为中间值正常语调 |
data.info.launch_tts | " " / "需要播放的文字" | String | 否 | 网络连接成功后播报,为" "时为静默启动 |
data.info.speaker | 0 | Integer | 否 | 0为女生,支持中英文 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "setting",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应成功 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 序列号 |
data.cmd_type | setting | String | 命令字 |
data.info | - | Object | 数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.msg | - | String | 响应消息 |
4.重启
暂无描述
接口状态
已完成
接口URL
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data": {
"cmd_type":"restart",
"info":{}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W70F9783874 | String | 是 | 设备序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | restart | String | 是 | 命令字 |
data.info | - | Object | 是 | 数据信息 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "restart",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应状态0为正常 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 设备序列号 |
data.cmd_type | restart | String | 命令字 |
data.info | - | Object | 返回数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.msg | - | String | 响应消息 |
错误响应示例
{
"code": 1000,
"msg": "没有操作此设备的权限"
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 1000 | Integer | 响应状态0为正常 |
msg | 没有操作此设备的权限 | String | 消息描述 |
5.进入配网模式
本接口调用就直接进配网模式了,没有参数,这个接口主要作用是锁在线时调用进入配网模式重新去做配网操作,方便安装位置手够不到用软件调用,一般场景用不到。
接口状态
已完成
接口URL
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data": {
"cmd_type":"wifi_config",
"info":{}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W71F9783874 | String | 是 | 序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | wifi_config | String | 是 | 命令字 |
data.info | - | Object | 是 | 数据信息 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "wifi_config",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应成功 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 序列号 |
data.cmd_type | wifi_config | String | 命令字 |
data.info | - | Object | 数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.msg | - | String | 响应消息 |
6.查询设备信息
暂无描述
接口状态
已完成
接口URL
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data": {
"cmd_type":"getdevinfo"
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W70F9783874 | String | 是 | 设备序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | getdevinfo | String | 是 | 命令字 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "getdevinfo",
"info": {
"code": 0,
"iccid": "53521B3B1655B175",
"imei": "6055F9766718",
"msg": "",
"project": "WMJ_CLOUDSPEAKER_C3",
"rssi": -40,
"speed": 5,
"tone": 5,
"version": "1.0.0",
"volume": 9
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应状态0为正常 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 设备序列号 |
data.cmd_type | getdevinfo | String | 命令字 |
data.info | - | Object | 返回数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.iccid | 53521B3B1655B175 | String | 物理地址 |
data.info.imei | 6055F9766718 | String | 芯片号 |
data.info.msg | - | String | 响应消息 |
data.info.project | WMJ_CLOUDSPEAKER_C3 | String | 项目名称 |
data.info.rssi | -40 | Integer | 信号值 |
data.info.speed | 5 | Integer | 0-9,语速由慢到快,默认为中间值正常语速 |
data.info.tone | 5 | Integer | 0-9,语调由低到高,默认为中间值正常语调 |
data.info.version | 1.0.0 | String | 版本 |
data.info.volume | 9 | Integer | 0-9,音量由小到大,默认为中间值 |
错误响应示例
{
"code": 1000,
"msg": "没有操作此设备的权限"
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 1000 | Integer | 响应状态0为正常 |
msg | 没有操作此设备的权限 | String | 消息描述 |
7.循环播放设置
暂无描述
接口状态
已完成
接口URL
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data":{
"cmd_type":"loop_play",
"info": {
"tts":"测试",
"interval":15,
}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W71F9783874 | String | 是 | 序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | loop_play | String | 是 | 命令字段 |
data.info | - | Object | 是 | 数据信息 |
data.info.tts | 5 | String | 是 | 循环播放TTS文字 |
data.info.interval | 5 | Integer | 是 | 循环播放间隔,单位: 秒(s) |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "loop_play",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应成功 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 序列号 |
data.cmd_type | setting | String | 命令字 |
data.info | - | Object | 数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.msg | - | String | 响应消息 |
8.循环播放停止
暂无描述
接口状态
已完成
接口URL
请求方式
POST
Content-Type
json
请求Body参数
{
"app_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"app_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5",
"device_sn": "W70F9766718",
"data":{
"cmd_type":"loop_stop",
"info": {}
}
}
参数名 | 示例值 | 参数类型 | 是否必填 | 参数描述 |
---|
app_id | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appid |
app_secret | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5 | String | 是 | 硬件云appsecret |
device_sn | W71F9783874 | String | 是 | 序列号 |
data | - | Object | 是 | 数据标签 |
data.cmd_type | loop_stop | String | 是 | 命令字段 |
data.info | - | Object | 是 | 数据信息 |
成功响应示例
{
"code": 0,
"data": {
"device_sn": "W70F9766718",
"cmd_type": "loop_stop",
"info": {
"code": 0,
"msg": ""
}
}
}
参数名 | 示例值 | 参数类型 | 参数描述 |
---|
code | 0 | Integer | 响应成功 |
data | - | Object | 数据标签 |
data.device_sn | W70F9766718 | String | 序列号 |
data.cmd_type | setting | String | 命令字 |
data.info | - | Object | 数据信息 |
data.info.code | 0 | Integer | 响应成功 |
data.info.msg | - | String | 响应消息 |
9.案例代码(PHP)
function PostJson($url, $data = NULL,$headers="")
{
$curl = curl_init();
$header =array(
'Content-Type: application/json; charset=utf-8',
'Content-Length:' . strlen(json_encode($data)),
'Cache-Control: no-cache',
'Pragma: no-cache'
);
if($headers){
$header[]=$headers;
}
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
if (!$data) {
return 'data is null';
}
if (is_array($data)) {
$data = json_encode($data);
}
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($curl);
$errorno = curl_errno($curl);
if ($errorno) {
return $errorno;
}
curl_close($curl);
return json_decode($res,true);
}
function Request($path, $data = [])
{
$data["app_id"] = "208ac48ff968ab0dc675008d0ded46d1";
$data["app_secret"] = "ad45d97d283c518e15b4bda75c887dec";
$res = PostJson("https://wdev.wmj.com.cn/deviceApi/".$path, $data);
return $res;
}
function regdev($device_sn)
{
$res = Request("register", ["device_sn" => $device_sn]);
if ($res["code"] != 0 && $res["code"] != 1005) {
return ["err" => $res["msg"]];
}
return $res;
}
function getonline($device_sn)
{
$res = Request("getOnLine", ["device_sn" => $device_sn]);
if ($res["code"] != 0) {
return 0;
}
return $res["data"]["on_line"];
}
function deldev($device_sn)
{
$res = Request("logout", ["device_sn" => $device_sn]);
if ($res["code"] != 0 && $res["code"] != 1005) {
return ["err" => $res["msg"]];
}
return $res;
}
function playttsaudio($device_sn,$ttscontent)
{
$res = Request("send", [
"device_sn" => $device_sn,
"data" => [
"cmd_type" => "play",
"info" => [
"tts" =>$ttscontent,
"inner" =>10,
],
]
]);
if ($res["code"] != 0) {
return ["err" => $res["msg"]];
}
if ($res["data"]["info"]["code"] != 0) {
return ["err" =>"播放失败".$res["data"]["info"]["msg"]];
}
return $res;
}
echo json_encode(regdev("W70F9783DC8"),JSON_UNESCAPED_UNICODE);
echo json_encode(playttsaudio("W70F9783DC8","您的订单还有15分钟结束,请及时续费,以免断电影响使用,谢谢"),JSON_UNESCAPED_UNICODE);