REST URL Parameter

REST URL Parameter

  

I am trying to use the distance matrix by using the following:

https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={x},{y}&destinations={xd},{yd}

Where x,y are latitude and longitude.

When i test it it works fine as seen in the picture

But when i use this in my app it says "not found"

Can any one help me?

Hi Mario,

I've tried your REST api (including your key... Try to remove/hide the key to avoid other people from using your private key.) and I just got a successful response status. What are the input values that you tried when calling the REST in your application?

Kind regards,

Remco Dekkinga

Hi,thanks for your reply.


I tried this input values:

Hi Mario,

I used the exact same inputs, because you tried them on the initial image too. My flow looks like this.

In the Var1 assignment I assign the Status of the response to a text variable and show this on my screen. It returns "Ok".

Can you share the OML where the error happens?

Kind regards,

Remco Dekkinga

I also get an ok status there but on the rows elements status i get not found and no distance or duration time.

Do you get a distance or duration time? What is the status of your rows elements?

Thanks for your help

You are correct. It gives a "NOT_FOUND" in the list of distances... Very strange indeed.

Remco Dekkinga wrote:

You are correct. It gives a "NOT_FOUND" in the list of distances... Very strange indeed.

Yes it is, i am strugling with this problem for the last three days and tryed everything and cant find the problem


if i use directly https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins=4,40&destinations=4,40 it works but when i try with input parameters it just doesnt work

Dont know what to try more. i need them has input variables so i dont want to put them directly on the url

Solution

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

Solution

Remco Dekkinga wrote:

Hi Mario,

I found a solution.

Use the following url: https://maps.googleapis.com/maps/api/distancematrix/json?units=metrics&origins={origins}&&destinations={destinations} and make sure the origins and destinations are strings.

The x and y coordinates should be seen as one string and somehow when adding a separate x and y coordinate to build the string in the URL is breaking the functionality.

Let me know if this is the solution for you.

Kind regards,

Remco Dekkinga

For the 40,4 and 4,40 it works, but whn i try with my location it gives the same error.

I am passing to the origins input like this 

SyntaxEditor Code Snippet

"GetLocation.Location.Latitude,GetLocation.Location.Longitude"



I've tried it with the following locations:

origins=55.93,-3.118

destinations=50.087,14.421

Somewhere in the UK and in the Czech Republic.

Can you share the locations that are failing?

Kind regards,

Remco Dekkinga

Remco Dekkinga wrote:

I've tried it with the following locations:

origins=55.93,-3.118

destinations=50.087,14.421

Somewhere in the UK and in the Czech Republic.

Can you share the locations that are failing?

Kind regards,

Remco Dekkinga

When i put numbers as you did

origins=55.93,-3.118

destinations=50.087,14.421

it works, but if i try

origins="GetLocation.Location.Latitude,GetLocation.Location.Longitude"

destinations=50.087,14.421

it gives not found


Hi Mario,

I'm not sure what you are trying to use for the origins, but the origins should be a geolocation in the form of "x,y".

In your case, when you have an action called GetLocation, which returns the Location(Latitude, Longitude) build the origins variable in the following way:

Origins = GetLocation.Location.Latitude + "," + GetLocation.Location.Longitude

If this doesn't work, please share your flow. I can check it with you.

Kind regards,

Remco Dekkinga

Thanks a lot