我试图在 ContextBroker
V1.5.0上注册天气预报,但得到以下错误: -
400 Bad Request {“error”:“BadRequest”,“description”:“属性必须是JSON对象,除非使用keyValues选项”}
请求:POST [http://ContextBroker IP]:1026 / v2 / entities
请求标头:Content-Type:application / json
这是有效载荷
{
"feelsLikeTemperature":31.8,
"dayMinimum":{"feelsLikeTemperature":31.8,"temperature":0.0,"relativeHumidity":31.0},
"temperature":0.0,
"dateCreated":"2016-12-01T12:05:00+05:30",
"type":"WeatherForecast",
"address":{"addressCountry":"IN","postalCode":"452001","addressLocality":"Indore"},
"windSpeed":3.7,
"validity":{"to":"2016-12-01T06:44:37Z","from":"2016-12-01T06:44:37Z"},
"source":"http://dataservice.accuweather.com/",
"precipitationProbability":0,
"dayMaximum":{"feelsLikeTemperature":31.8,"temperature":0.0,"relativeHumidity":31.0},
"weatherType":"Partly sunny",
"windDirection":"ENE",
"id":"452001_IN_YYYY-12-DD ",
"relativeHumidity":31.0
}
我在http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html上验证了 FIWARE
数据模型,但它似乎没有工作 . 有谁知道这个问题的解决方案?
1 回答
您正在使用'keyValues'表示,因此您需要使用?options = keyValues进行POST
顺便说一下,WeatherForecast数据模型刚刚更新了一些调整,以符合GSMA规范 .
http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html
谢谢!