NodeJS 中的 AWS IOT 更新事物验证错误
AWS IOT Update Thing Validation Error in NodeJS
我尝试使用 aws nodejs sdk更新我的 IOT 东西,但它给了我一个 "Validation Error"异常
代码:
var AWS = require("aws-sdk");
AWS.config.apiVersions = {
iot: '2015-05-28',
};
var attribs = {};
attribs.type = "Type Value";
attribs.name = "Device Name";
var params = {
thingName: thing_name,
attributePayload: {
attributes: attribs
}
};
iot.updateThing(params, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
console.log(data); // successful response
}
});
异常:
message: '1 validation error detected: Value \'{name=Device Value, type=Type Value}\' at \'attributePayload.attributes\' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 1024, Member must have length greater than or equal to 0, Member must satisfy regular expression pattern: [a-zA-Z0-9_.,@/:#-]+]',
code: 'InvalidRequestException',
time: Mon Mar 14 2016 07:00:13 GMT+0000 (UTC),
requestId: '53474c09-e9b2-11e5-a613-a924097ce6cf',
statusCode: 400,
retryable: false,
retryDelay: 44.59372889250517
有人知道我的 updateThing 代码有什么问题吗?我需要更新一个 Iot 东西
物联网事物的属性值不应包含space
已尝试以下属性
attribs.type = "Type_Value";
attribs.name = "Device_Name";
它运行良好。物联网设备也只能附加三个属性。
我尝试使用 aws nodejs sdk更新我的 IOT 东西,但它给了我一个 "Validation Error"异常
代码:
var AWS = require("aws-sdk");
AWS.config.apiVersions = {
iot: '2015-05-28',
};
var attribs = {};
attribs.type = "Type Value";
attribs.name = "Device Name";
var params = {
thingName: thing_name,
attributePayload: {
attributes: attribs
}
};
iot.updateThing(params, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
console.log(data); // successful response
}
});
异常:
message: '1 validation error detected: Value \'{name=Device Value, type=Type Value}\' at \'attributePayload.attributes\' failed to satisfy constraint: Map value must satisfy constraint: [Member must have length less than or equal to 1024, Member must have length greater than or equal to 0, Member must satisfy regular expression pattern: [a-zA-Z0-9_.,@/:#-]+]',
code: 'InvalidRequestException',
time: Mon Mar 14 2016 07:00:13 GMT+0000 (UTC),
requestId: '53474c09-e9b2-11e5-a613-a924097ce6cf',
statusCode: 400,
retryable: false,
retryDelay: 44.59372889250517
有人知道我的 updateThing 代码有什么问题吗?我需要更新一个 Iot 东西
物联网事物的属性值不应包含space
已尝试以下属性
attribs.type = "Type_Value";
attribs.name = "Device_Name";
它运行良好。物联网设备也只能附加三个属性。