Geocoding Tutorial

This forum contains topics that were moved from Get Satisfaction
Asif Ansari
Posts: 0
Joined: Tue Jul 07, 2015 4:00 am

Geocoding Tutorial

Post 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!

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Geocoding Tutorial

Post by Alena Prykhodko »

Hello Asif,

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

Asif Ansari
Posts: 0
Joined: Tue Jul 07, 2015 4:00 am

Geocoding Tutorial

Post 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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Geocoding Tutorial

Post 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.

Asif Ansari
Posts: 0
Joined: Tue Jul 07, 2015 4:00 am

Geocoding Tutorial

Post 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?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Geocoding Tutorial

Post 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.

Asif Ansari
Posts: 0
Joined: Tue Jul 07, 2015 4:00 am

Geocoding Tutorial

Post 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

Post Reply