在本教程中:https://github.com/telefonicaid/iotagent-json/blob/master/docs/stepbystep.md
当我执行curl时:
curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Fiware-Service: myHome" -H "Fiware-ServicePath: /environment" -H "Cache-Control: no-cache" -d '{
"value" : "300"
}' 'http://localhost:1026/v1/contextEntities/LivingRoomSensor/attrs/sleepTime'
我收到此错误回复:
{
"orionError" : {
"code" : "400",
"reasonPhrase" : "Bad Request",
"details" : "service not found"
}
}
如何解决这个问题?
Cumps
答案 0 :(得分:2)
好像你正在混合"来自NGSIv1和NGSIv2的URL样式:)我的意思是,它应该是:
/v2/entities/LivingRoomSensor/attrs/sleepTime
或
/v1/contextEntities/LivingRoomSensor/attributes/sleepTime
我的推荐总是使用NGSIv2,因为它是Orion Context Broker提供的更强大,灵活和简单的上下文管理API版本。
答案 1 :(得分:0)
通过改变解决:
localhost:1026/v1/contextEntities/LivingRoomSensor/attrs/…
到
localhost:1026/v1/contextEntities/LivingRoomSensor/attributes/…