Page 1 of 1

Geocoding Tutorial

Posted: Thu Jul 30, 2015 1:54 am
by Asif Ansari

Hi, I was working through the geocoding tutorial and had some of the issues that have already been posted, but can't seem to find what the problem is. I found a way for it to work, but its not exactly what the tutorial shows. When I use the following code:

var latitude = requestParams["latitude"];
var longitude = requestParams["longitude"];
var radius = requestParams["radius"];

It works when I add these into the query string section of the service that I created. The tutorial suggests that I need to add these into the body section, but then it doesn't work showing a bad parameter issue. Also, the tutorial suggests to use this code:

var latitude = request.object().latitude;
var longitude = request.object().longitude;
var radius = request.object().radius;

When I use intellisense, object() is not found. Also, the code causes an error in test upon trying to get the latitude. Is there a different syntax that would allow it to work with the params being in the body? I have it working, but I want to do it the correct way following best practice. Thanks for the help!


Geocoding Tutorial

Posted: Fri Jul 31, 2015 12:15 pm
by Alena Prykhodko

Hello Asif,

Could you please be more specific, do you use this tutorial https://devcenter.appery.io/tutorials...?


Geocoding Tutorial

Posted: Fri Jul 31, 2015 2:00 pm
by Asif Ansari

Hi Alena, that is exactly the tutorial I was referring to. I am not sure how to get the code working if I added the parameters in the body section. Also, what is the difference between using the query string vs the body? Thanks for all your help.


Geocoding Tutorial

Posted: Tue Aug 04, 2015 2:46 am
by Yurii Orishchuk

Hi Asif,

pre

var latitude = requestParams["latitude"];
var longitude = requestParams["longitude"];
var radius = requestParams["radius"];

/pre

If you use it in this way you need to pass parameters in "request string" section.

Please add this parameters to "request string" section.

Regards.


Geocoding Tutorial

Posted: Tue Aug 04, 2015 2:59 am
by Asif Ansari

Yurii, thank you, but I don't think you read my quesion all the way through. I already got it to work with that method. I wanted to know how to get it to work with the other method using :

var latitude = request.object().latitude;
var longitude = request.object().longitude;
var radius = request.object().radius;

This code gives me an error, but its what is used in the tutorial. Why does this give an error?


Geocoding Tutorial

Posted: Tue Aug 04, 2015 3:23 am
by Yurii Orishchuk

Asif,

If you want to use "POST" method you need to send it with given in tutorial way.

Please check if you have correctly set your service.

Details: http://prntscr.com/80l1su/direct

Regards.


Geocoding Tutorial

Posted: Tue Aug 04, 2015 12:30 pm
by Asif Ansari

Yurii, I guess the issue is when I am trying to test it in the server code section before I create a service for it. How do I format the request body section to perform a proper test? I get the following error. Image