Contentful logo

Contentful Community

Creating entry containing Location type using JAVA CMA API

Hi All,

I am trying to create an entry with one of the field as Location type using CMA java API. I am setting the Object with just the ‘lon’ and ‘lat/’ value but getting the below error.

“The property “map” is not allowed here.”

Somehow a key map is added to the JSON, “location”:
{
“en-US”: {
“map”: {
“lon”: -46.98001690000001,
“lat”: -22.0630585
}
}
}

Any pointer here?

I was trying to set a JSONObject type value but it was expecting a Location type value. So I created a Location POJO with lat and lon property. And used it to set the value for location.
Ideally, CMA API should have a location class similar to CDA API.