saveDevProperty
写入自定义设置的设备属性数据,保存后可通过 getDevProperty 获取。
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
devId | String | 设备 ID | 是 |
bizType | Number | 业务类型(自定义) | 是 |
propertyList | String | 自定义属性,支持批量 k-v,格式为 stringify 后的 DeviceProperty[] | 是 |
DeviceProperty
参数 | 数据类型 | 说明 |
---|---|---|
code | String | 设备自定义属性 key,最长 30 字节("device_favorite"为系统保留 code,请勿使用) |
value | String | 设备自定义属性内容,最长 1024 字节 |
返回结果
Boolean boolean
请求示例
import { saveDevProperty } from '@ray-js/ray';
saveDevProperty({
devId: 'vdevxxxxx',
bizType: 0,
propertyList: JSON.stringify([
{ code: 'hello', value: 'world' },
{ code: 'foo', value: 'bar' },
]),
})
.then((response) => {
console.log(response);
})
.catch();
返回示例
true;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
getDevProperty
获取自定义设置的设备属性数据,可通过 saveDevProperty 写入。
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
devId | String | 设备 ID | 是 |