[英]AWS IoT JSON Error
I'm trying to get a Skywire LTE Cat 1 modem ( http://nimbelink.com/skywire-4g-lte-cat-1/ ) to update a thing shadow on AWS IoT. 我正在尝试使用Skywire LTE Cat 1调制解调器( http://nimbelink.com/skywire-4g-lte-cat-1/ )来更新AWS IoT上的事物阴影。 I have the device talking to AWS via HTTP, and am able to execute a GET command per their tutorial.
我让设备通过HTTP与AWS通信,并且能够根据他们的教程执行GET命令。
Now I am trying to execute a POST command to update my thing's shadow. 现在我正在尝试执行POST命令来更新我的东西的影子。 However, whenever I try to send my POST command:
但是,每当我尝试发送POST命令时:
POST /things/AWS_Test_Thing/shadow HTTP/1.1
BODY: {"state":{"reported":{"Temp":55}}}
AWS sends me the following error: AWS向我发送以下错误:
HTTP/1.1 Bad Request
{"message":"Payload contains invalid json","traceId":"e53be1d6-7967f52c-4dd6-d7b95cc20628"}
I've never used JSON before, but from what I can gather, 我之前从未使用过JSON,但是从我可以收集的内容来看,
{"state":{"reported":{"Temp":55}}}
should be valid JSON and complies with AWS IoT documentation ( http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-document-syntax.html#thing-shadow-example-request-json ). 应该是有效的JSON并且符合AWS IoT文档( http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-document-syntax.html#thing-shadow-example-request-json )。 What am I missing?
我错过了什么?
如果您通过POST请求更新阴影,则应该有“所需”语句而不是“已报告”。
Make sure you have the Content-Length
header included as part of the request and signing procedure. 确保在请求和签名过程中包含
Content-Length
标头。 The Content-Length
must reflect the size of the JSON payload you are sending. Content-Length
必须反映您要发送的JSON有效负载的大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.