Get Webhook Google Distance Matrix - INVALID REQUEST
I am running a GET Webhook with the URL https://maps.googleapis.com/maps/api/distancematrix/json when I hard code this link with the right params it works fine. The information is retrieved. But when I put it into the Query String Params I receive an “INVALID_REQUEST”. I have even tried leaving the key=MY_API in the URL to see if that would help. I can not hard code the entire URL because the “destination” param comes from a form on our website.
Any ideas what might be causing this? Is there something on the Google Cloud console side that could be causing this issue?
Page 1 / 1
Hi @laurenroth
For us to have more info, post these screenshots:
how your Zap step is configured in EDIT mode with the field mappings
the encountered error
And just to confirm again, if I hard code the URL it works fine, so don’t think it is an API issue.
Thanks
@laurenroth
Couple things to check/try:
In the Query String Params section
for “destinations”, on the right side, remove “destinations=”
for “origins”, try removing all the + and instead use spaces
Zapier will properly encode the data when sent in the API request
for “destinations”, try removing all the + and instead use spaces
Zapier will properly encode the data when sent in the API request
Thanks for the feedback - Now I am getting this Error: “You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account”
I don’t really understand this because when I just put all the info into a URL is works fine. It makes me think there is some setting on the Google side where it doesn’t like talking to Zapier. Any ideas on what that might be?
Thanks
@laurenroth What was the link to the Google API endpoint documentation you reference to configure the API request?
Try moving the key from the URL field to the Query String Parameters field.
If you need more help, post updated screenshots with how your Zap step is configured along with encountered errors.
Is this what you mean?
@laurenroth
This is the link to the GMaps API endpoint documentation.
If that fix still results in an error for the API request, then try this:
Change it to this Zap action: Webhooks - Custom Request (GET)
For the URL field, include all of the query string parameters.
Alright the typo was not the issue. I used the Custom Request and got it to work (see images). But how do I get it to work when I want it to pull data coming from a form in the previous step?
Thanks!
@laurenroth
You would need to map variables from a previous step to be in place of the desired query string parameter values.
Use the +] button in a field to map variables.
If needed use this Zap action: Formatter > Text > URL Encode
I can try that but why doesn’t the GET just work even when I hard code the information in? It is not related to the mapping if I am not trying to pull data but just hard code info in. Any ideas on why that doesn’t work correctly?
@laurenroth
It could be related to the other field settings in the GET requests, but the screenshots did not show those fields to review.