Add Map datum as Query Parameter


I’m trying to add map datum (latitude & longitude) as a queryParameter for a post method. My example Post Request needs to look like this:
“dateOfRegistration” : 1416847649000,
“locationOfRegistration” : { “latitude”: 18.517162, “longitude”: 73.855269 }
Our existing APi specifies this as an object, which isn’t allowed as a queryParameter. Anyone got an idea how best to proceed? Do I need to specify a separate latitude and longitude queryParameter as integers?


I think you would need to :wink:


Unfortunately, I have to keep the Post request as it is, I can’t create a separate latitude and longitude parameter. Is there another way of referencing this kind of data with RAML?


I mean, why not using query parameter in this case?


Agree with Christian… something is wonky with your API requirement if what you are saying is true. It should be separate parameters. Either that, or you have no choice but to accept is as a String, then require the parsing of that string on the API server side. You could have it as a JSON string, and then use a JSON parsing library to convert the string into an internal object… not sure if you are using Java, but if so, GSON would be good for this.


Working with the developer, we have now defined lat and long in a schema as numbers and refer to them in our locationOfRegistration object. This works as we want it.