Bruno Vaz Moço
Posts: 0
Joined: Tue May 14, 2013 2:21 pm

Complex structure in post request

Hey,

I'm having trouble making a post request to the geoloqi api. The problem is that I cannot create the right structure for the request parameters in Appery's interface.

This is a sample code of what I need to create in Appery:

[{
"date": "2010-07-23T09:19:38-07:00",
"location": {
"position": {
"latitude": 45.445793867111,
"longitude": -122.64261245728,
"speed": 10,
"altitude": 0,
"horizontal_accuracy": 24,
"vertical_accuracy": 0
},
"type": "point"
},
"raw": {
"distance_filter": 5,
"tracking_limit": 2,
"rate_limit": 60,
"battery": 86
},
"client": {
"name": "Geoloqi",
"version": "0.1",
"platform": "iPhone OS 4",
"hardware": "iPhone2,1"
}
}]

The request inside Appery's test interface works partially becuase I still can't make the variables "latitude" and "longitude" to be isolated variables so I can set them from phone's location.

So one problem is to get the latitude and longitude variables independent so I can map them with the interface.

The second (and bigger problem) is that the request doesn't work in the browser tester. I have tried with the Appery proxy and still doesn't work (while other requests for the same api work with the Appery proxy).

Here is what I have at this moment in Appery:
https://dl.dropboxusercontent.com/u/5...

Does anyone know how to solve this?

Best regards,
Bruno

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Complex structure in post request

Hi Bruno,

Your data is surrounded by square brackets. Do you need to send an array as a request? If not then you're building quite a strange structure.

You can't describe an extra structure in the variable, as it will be the transmitted as a string, rather than the structure.
I.e. you would need to repeat all the planned structure.

Geolocation service returns independent points of longitude and latitude, so there is no problem in keeping them as independent variables in localStrorage with the following transfer to a query.

Also the root field without a name sends to the server an error, actually, because a structure property must always have a name.

Bruno Vaz Moço
Posts: 0
Joined: Tue May 14, 2013 2:21 pm

Complex structure in post request

Hello Katya,

Thank you for your reply! :-)

Yes the data must be sent as an array, this is the description of the parameteres of the api I'm using: https://developers.geoloqi.com/api/lo...

I updated now the structure to have the array with a name in Appery interface, still it doesn't work on the mobile tester (even with proxy activated).

Regarding the strucutre, I'm not sure I understood, does this means that I can't pass the structure that I need through the interface? In the Appery test feature it works, just the mobile tester that doesn't...

Should I do something differently?

I appreciate your support!

Bruno.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Complex structure in post request

Hello! Sorry for late reply. geoloqi requires you to send data as an array, in Appery.io you can send data as an object only. You can't send data as an array from standard REST service, but you can create Generic service (here is more information https://getsatisfaction.com/apperyio/...). Using that service you can send any data with any format.

Return to “Issues”