Azure API Management & Google Maps : A basic example

Amine Charot
3 min readAug 6, 2020

--

Hello everyone, I hope you’re doing well and you are enjoying your holidays.

Today’s post is far away from security, I will try to explore new possibilities with Azure API Management. As I said in the Azure Advent Calendar, we may manage Google Maps API through API Management.

In this post, I will show you a demonstration about it. First, We will need an instance of Azure API Management, so let’s create one :

An instance of Azure API Management in the Consumption Tier will be enough.

Once is done we will need to configure it so it can send requests to the Google Maps API.

In order to access to the Google API, we have to generate an API Key.

Then we need to enable an API. In my example I will enable Directions API :

Let’s create the API that will expose the Google Directions API :

In the web service URL, I put the backend which is the rest location which is :

https://maps.googleapis.com/maps/api/directions

Now, we have to create the operation, as described in the Google Maps API, the URL is :

https://maps.googleapis.com/maps/api/directions/json?
origin=Toronto&destination=Montreal
&key=YOUR_API_KEY

We have the output format (json) which will be the URL of the operation.

We also have three query parameters :

  • Orgin;
  • Destination;
  • Key.

We need to create the same operation in API Management:

That’s all. Let’s test it with some query parameters that won’t work :

The response is :

Let’s try then to give the right query parameters :

The response given is :

So yes, we can use API Management to expose Google Maps API.

Please, note that this was a basic example on how to implement Azure API Management with Google Maps. You may implement everything what I’ve talked about in my session of Azure Advent Calendar :

Ciao,

--

--