Do you want to know how to set the Google Map API? Do you even know what an API is? API stands for application programming interface. An API is a connection between two pieces of software. It allows them to communicate and offer a service from one software to another. The map at the bottom is one such API. Google Maps is lending that website their application programming interface, API, so that they can use Google Map’s various capabilities for use on their website to up their website design game. In this article, you will learn how to set the Google Map API, how to create an API, and how to add the different APIs available through Google.
Google Map API Key
Before you learn how to set the Google Map API, you need to learn what a Google Map key is. A Google Map API key is a bit of code provided by Google that you can use to display Maps, give directions, accurately display close and open times, create searchable maps, add check-in features, and plan routes on your business’s website. Google Map API keys let Google track how their APIs are used and protect themselves from malicious attacks. You can combine APIs for more advanced options that will make your customer’s user experience the best it can be.
Google Map API keys are free and to get you started, Google offers a $300 credit to use for your first 90 days of use. After that, they will continue to provide you with $200 per month to use toward your Google Maps API usage. Once you exceed the $200 per month limit, you will be charged per use.
How To Create an API
Now that you know what a Google Map API is, you can understand how to create an API for your own website.
The first step to creating an API for Google Maps is to set up a project associated with a billing account and the Maps Embed API enabled. The Maps Embed API is the API that allows you to place an interactive map on your website. Once you set this up, you can start creating new APIs.
Creating the API Key
Once you have completed the necessary setup, you can begin learning how to create an API. Depending on whether you are using a console or Cloud SDK, the process of creating an API will be different.
- Go to the credentials section of the Google Platform website.
- Select Create Credentials.
- Click Create API Key. A dialogue box will appear confirming that you have created a new API.
- Click close.
To create an API using Cloud SDK, you will need to add a line of code. The code is as follows:
gcloud alpha services api-keys create \
–project “PROJECT” \
You will replace the words in parentheses, PROJECT and DISPLAY_NAME, with your desired names.
You have now created your first API. It will be listed under API Keys on the credentials page.
How to Restrict an API Key
Now that you have learned how to create an API Key, you need to know how to restrict it. Restricting your API keys adds a level of security that will ensure that only authorized requests can be made with your API key. The process of restricting your API key will differ depending on whether you are using console or Cloud SDK.
- Go to the credentials page of the Google platform website.
- Select the API you want to restrict.
- You will find a section called Key Restrictions. Review and choose which restrictions you would like to set for your API.
This is the code to list existing keys:
gcloud services api-keys list –project=”PROJECT”
This is the code to clear current restrictions:
gcloud alpha services api-keys update “projects/PROJECT/keys/KEY_ID” \
This is the code to set new restrictions:
gcloud alpha services api-keys update “projects/PROJECT/keys/KEY_ID” \
Once again, the words in parenthesis should be replaced with your own names.
If you do not have the time to create your own API, Google has many APIs available for use right now on your website or app. To add an API, all you have to do is follow the steps below.
Maps Static API
This API displays a simple, static image of a map on your website. There is minimal code and pricing is flexible. There are two pricing tiers. You can either pay $2 per 1,000 requests or $1.60 per 1,000 requests with a 100,000 per month minimum.
Maps Embed API
This API allows you to place an interactive map or street view on your website. The user can move around the map to find different locations. This API can help customers find where they are in relation to your business.
Distance Matrix API
This API allows the user to see both the distance and time it will take to travel to a location for multiple destinations based on a recommended route. The price for tier one of the advanced plan is $10 per 1,000 elements and the price for tier two of the advanced plan is $8 per 1,000 elements with a minimum of 100,000 elements per month. The other plan costs $5 per 1,000 elements and tier two costs $4 per 1,000 elements with 100,000 elements per month minimum. The only difference between the advanced plan and the basic plan is that the advanced plan offers access to real-time traffic reports.
This API is useful when GPS is not an option. It uses WIFI access points and cellphone towers to find a location. Pricing for tier one is $5 per 1,000 requests and pricing for tier two is $4 per 1,000 requests with a minimum of 100,000 requests per month.
The Places API allows you to see and get detailed information about over 100,000,000 businesses and points of interest. It is constantly getting updated with new businesses and points of interest added by both business owners and users. The Places API has multiple pricing options so you can choose the one that best fits your needs.
Autocomplete Without Places Details
Tier one is $17 per 1,000 sessions and tier two is $13.60 per 1,000 sessions with a minimum of 100,000 sessions per month.
Tier one is $2.83 per 1,000 requests and tier two is $2.27 per 1,000 requests with a minimum of 100,000 requests per month.
Tier one is $17 per 1,000 requests and tier two is $13.60 per 1,000 requests with a minimum of 100,000 requests per month.
Places Details – ID Refresh
This is a free addition to Places Details. It gives you the ability to return new place IDs.
As the name suggests, this returns atmospheric data. Tier one is $5 per 1,000 count and tier two is $4 per 1,000 count with a minimum of 100,000 count per month.
This provides you with the ability to display contact information like phone numbers, websites, and hours of operation. This costs $3 per 1,000 count for tier one and $2.40 per 1,000 count with a minimum of 100,000 count per month.
Find Place allows you to use a phone number, name, or address to find a place along with its phone number and address. Tier one is $17 per 1,000 requests and tier two is $13.60 per 1,000 requests with a 100,000 request minimum per month.
If you would like only the place ID, Find Place is free.
Places Nearby Search
This function will return a list of nearby places to the user. Tier one is $32 per 1,000 requests and tier two is $25.60 per 1,000 requests with a minimum of 100,000 requests per month.
Places Photo lest you high-quality photos of businesses and points of interest to your map. Tier one is $7 per 1,000 requests and $5.60 per 1,000 requests with 100,000 minimum requests per month.
Places- Text Search
Users can search for location suggestions. This function will return a list of places that match the search criteria. Tier one costs $32 per 1,000 requests and tier two costs $25.60 per 1,000 requests with a minimum of 100,000 requests per month.
As the name suggests, this function will try to autocomplete searches for the user. Tier one costs $2.83 per 1,000 requests and tier two costs $2.27 per 1,000 requests with a 100,000 request per month minimum.
Time Zone API
The Time Zone API provides the user with time zone accurate information like hours of operation. Tier one costs $5 per 1,000 requests and $4 per 1,000 requests with a 100,000 request minimum per month.
Google Maps is a useful tool that people can use to find directions, hours off operation, traffic reports, and many other things. If you want to enable these capabilities on your business’s website, you will need to use APIs. Allow visitors to drop a pin on their favorite of your locations using APIs. Now that you have learned how to set the Google Map API, how to create an API and the types of APIs offered through Google you can add a Google Map to your business’s website.
- What is an API?
- Why should I use Google Maps API?
- How much does an API cost?
- How do I buy an API?
- What does the Google Maps API do?