• 本api适用于序列号开头为W70F/W70M的设备,appid和appsecret请到wdev.wmj.com.cn 填用手机号或邮箱登录获取。

1.注册设备

  • 将设备和appid、appsecret绑定

请求URL

  • https://wdev.wmj.com.cn/deviceApi/register

请求方式

  • POST

请求格式

  • json

参数

{
	"app_id": "",
	"app_secret": "",
	"device_sn": ""
}
参数名必选类型说明
app_idstring用户app_id
app_secretstring用户app_secret
device_snstring设备序列号

返回示例

{
	"code": 0,
	"msg": "注册成功"
}
{
	"code": 1005,
	"msg": "设备已注册"
}

返回参数说明

参数名类型说明
codeint错误码 0成功其他异常
msgint描述

备注

  • 更多返回错误代码请看首页的错误代码描述

2.播放云语音

接口状态

已完成

接口URL

  • https://wdev.wmj.com.cn/deviceApi/send

请求方式

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,//wifi版特有
			"volume": 3//4G版本1-6,wifi版1-6
        }
    }
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW70F9766718String序列号
data-Object数据标签
data.cmd_typeplayString命令字
data.info-Object数据信息
data.info.tts您的订单还有15分钟结束,请及时续费,以免断电影响使用,谢谢String要播放的文本
data.info.inner10Integer头部提示音,取值范围1-15

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "play",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应成功
data-Object数据标签
data.device_snW70F9766718String序列号
data.cmd_typeplayString命令类型
data.info-Object数据信息
data.info.code0Integer响应代码
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,  // 0-9,音量由小到大,默认为中间值
            "speed":5,   // 0-9,语速由慢到快,默认为中间值正常语速
            "tone":5,     // 0-9,语调由低到高,默认为中间值正常语调
			"launch_tts":" ", // 网络连接成功后播报
			"speaker":0 // 0为女生,支持中英文
        }
    }
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW71F9783874String序列号
data-Object数据标签
data.cmd_typesettingString命令字
data.info-Object数据信息
data.info.volume5Integer0-9,音量由小到大,默认为中间值
data.info.speed5Integer0-9,语速由慢到快,默认为中间值正常语速
data.info.tone5Integer0-9,语调由低到高,默认为中间值正常语调
data.info.launch_tts" " / "需要播放的文字"String网络连接成功后播报,为" "时为静默启动
data.info.speaker0Integer0为女生,支持中英文

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "setting",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应成功
data-Object数据标签
data.device_snW70F9766718String序列号
data.cmd_typesettingString命令字
data.info-Object数据信息
data.info.code0Integer响应成功
data.info.msg-String响应消息

4.重启

暂无描述

接口状态

已完成

接口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":"restart",
		"info":{}
	}
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW70F9783874String设备序列号
data-Object数据标签
data.cmd_typerestartString命令字
data.info-Object数据信息

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "restart",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应状态0为正常
data-Object数据标签
data.device_snW70F9766718String设备序列号
data.cmd_typerestartString命令字
data.info-Object返回数据信息
data.info.code0Integer响应成功
data.info.msg-String响应消息

错误响应示例

{
	"code": 1000,
	"msg": "没有操作此设备的权限"
}
参数名示例值参数类型参数描述
code1000Integer响应状态0为正常
msg没有操作此设备的权限String消息描述

5.进入配网模式

本接口调用就直接进配网模式了,没有参数,这个接口主要作用是锁在线时调用进入配网模式重新去做配网操作,方便安装位置手够不到用软件调用,一般场景用不到。

接口状态

已完成

接口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":"wifi_config",
		"info":{}
	}
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW71F9783874String序列号
data-Object数据标签
data.cmd_typewifi_configString命令字
data.info-Object数据信息

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "wifi_config",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应成功
data-Object数据标签
data.device_snW70F9766718String序列号
data.cmd_typewifi_configString命令字
data.info-Object数据信息
data.info.code0Integer响应成功
data.info.msg-String响应消息

6.查询设备信息

暂无描述

接口状态

已完成

接口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":"getdevinfo"
	}
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW70F9783874String设备序列号
data-Object数据标签
data.cmd_typegetdevinfoString命令字

成功响应示例

{
	"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
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应状态0为正常
data-Object数据标签
data.device_snW70F9766718String设备序列号
data.cmd_typegetdevinfoString命令字
data.info-Object返回数据信息
data.info.code0Integer响应成功
data.info.iccid53521B3B1655B175String物理地址
data.info.imei6055F9766718String芯片号
data.info.msg-String响应消息
data.info.projectWMJ_CLOUDSPEAKER_C3String项目名称
data.info.rssi-40Integer信号值
data.info.speed5Integer0-9,语速由慢到快,默认为中间值正常语速
data.info.tone5Integer0-9,语调由低到高,默认为中间值正常语调
data.info.version1.0.0String版本
data.info.volume9Integer0-9,音量由小到大,默认为中间值

错误响应示例

{
	"code": 1000,
	"msg": "没有操作此设备的权限"
}
参数名示例值参数类型参数描述
code1000Integer响应状态0为正常
msg没有操作此设备的权限String消息描述

7.循环播放设置

暂无描述

接口状态

已完成

接口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":"loop_play",
    	"info": {
            "tts":"测试",
			"interval":15,
        }
    }
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW71F9783874String序列号
data-Object数据标签
data.cmd_typeloop_playString命令字段
data.info-Object数据信息
data.info.tts5String循环播放TTS文字
data.info.interval5Integer循环播放间隔,单位: 秒(s)

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "loop_play",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应成功
data-Object数据标签
data.device_snW70F9766718String序列号
data.cmd_typesettingString命令字
data.info-Object数据信息
data.info.code0Integer响应成功
data.info.msg-String响应消息

8.循环播放停止

暂无描述

接口状态

已完成

接口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":"loop_stop",
    	"info": {}
    }
}
参数名示例值参数类型是否必填参数描述
app_idxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appid
app_secretxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5String硬件云appsecret
device_snW71F9783874String序列号
data-Object数据标签
data.cmd_typeloop_stopString命令字段
data.info-Object数据信息

成功响应示例

{
	"code": 0,
	"data": {
		"device_sn": "W70F9766718",
		"cmd_type": "loop_stop",
		"info": {
			"code": 0,
			"msg": ""
		}
	}
}
参数名示例值参数类型参数描述
code0Integer响应成功
data-Object数据标签
data.device_snW70F9766718String序列号
data.cmd_typesettingString命令字
data.info-Object数据信息
data.info.code0Integer响应成功
data.info.msg-String响应消息

9.案例代码(PHP)

//发送json请求函数
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);

}
//组装发送请求,带上appid,appsecret
 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;
}
//播放TTS语音
function playttsaudio($device_sn,$ttscontent)
{
        $res = Request("send", [
            "device_sn" => $device_sn,
            "data" => [
                "cmd_type" => "play",
                "info" => [
                "tts" =>$ttscontent,
                "inner" =>10,//这个参数是播报开头叮咚提示音,有15种,不同场合选择不同。
            ],
            ]
        ]);
        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);
//调用播放TTS语音
echo json_encode(playttsaudio("W70F9783DC8","您的订单还有15分钟结束,请及时续费,以免断电影响使用,谢谢"),JSON_UNESCAPED_UNICODE);
作者:极客师傅  创建时间:2025-03-09 00:25
最后编辑:极客师傅  更新时间:2025-04-27 12:41