我正在尝试在ContextBroker
V1.5.0上注册天气预报但收到以下错误: -
400 Bad Request { “错误”:“BadRequest”, “description”:“属性必须是JSON对象,除非使用keyValues选项” }
请求: POST http://[ContextBroker IP]:1026 / v2 / entities
请求标题: 内容类型:应用/ 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
数据模型进行了验证,但似乎无效。有谁知道这个问题的解决方案?
答案 0 :(得分:3)
您正在使用' keyValues'表示,所以你需要使用?options = keyValues
进行POST顺便提一下WeatherForecast数据模型的更新,并进行了一些调整,以符合GSMA规范。
http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html
谢谢!