简体   繁体   中英

Error registering Weather Forcast data model (NGSI v2)

I am trying to register weather forcast on ContextBroker V1.5.0 but getting below error :-

400 Bad Request { "error": "BadRequest", "description": "attribute must be a JSON object, unless keyValues option is used" }

Request: POST http://[ContextBroker IP]:1026/v2/entities

Request header : Content-Type:application/json

Here is the payload

 {
    "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
}

I verified with FIWARE data models on http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html but it does not seem to be working. Does anyone know solution to this problem?

you are using the 'keyValues' representation so you need to do your POST with ?options=keyValues

by the way the WeatherForecast data model just landed updated with some adjustments to comply with GSMA specification.

http://fiware-datamodels.readthedocs.io/en/latest/Weather/WeatherForecast/doc/spec/index.html

thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM