1. 创建设备密码

创建设备密码

POST:http://api.xdua.com/jobq

所有字段都放置在body里

字段名 字段位置 字段类型 字段说明 举例 必选
apiv head string API版本,默认是1.0.0 1.0.0 可选
Authorization head string 客户端保存的鉴权token Authorization字符串 必选
pkey body string 产品的KEY 必选
name body string 设备的名字 必选
secret body string 设备的密钥 必选
clientid body string 客户端ID 必选
    const dua = await lovearth({
        APP_KEY: "EIxcPdpT",
        APP_SECRET: "b8466f37b99bea6496b192be399cfbd2",
    })
    api_name = "制作IOT密码";
    add_params = {
        pkey:"productKey",
        name:"deviceName",
        secret:"deviceSecret",
        clientid:"clientid"
    }
    res = await dua.addIotpass(add_params)
    console.log(res)
    if(res.error == 0){
        console.log(api_name+"成功");
    }else{
        console.log(api_name+"失败 "+res.reason);
    }

1.1. 成功的返回

返回的id便是新创建的obj的id.

{ 
    result:{ 
        param:{ clientid: 'clientid',name: 'deviceName',secret: 'deviceSecret' },
        name: 'deviceName@productKey',
        pass: 'DB5FFBC033DE8A6177DF199407BCE26D8C6867CB' },
        error: 0,
        reason: 'success' 
        }

    }

1.2. 失败的返回

{
    "error": 1,
    "reason": "失败原因",
    "result": {"失败返回的参考数据"}
}

1.3. 错误码

results matching ""

    No results matching ""