Accueil » Course lessons » Creating an API Key for Using Google and Azure Maps dans WordPress
Creating an API Key for Using Google and Azure Maps dans WordPress
To use Toolset with Google Maps or Azure Maps, you must enter an API key. To create this key, you must first set up an account with the maps service of your choice.
To get an API key for the map service of your choice, you must set up an account billing information. This is true for both Google Maps and Azure Maps. Then, your account will have a limited amount of free API calls that can be made each month. If you cross that limit, your account will automatically be charged.
Creating an API key for Google Maps
To protect your API key from unauthorized usage and charges, it’s important to add domain restrictions to it. By setting restrictions, you can specify the websites that are allowed to use your API key, preventing unauthorized access from other sites. You can set these restrictions in the Google settings for your API key.
If you do not have an account for Google Maps, go to the Google Maps Platform page and click the Get Started button:
In the pop-up dialog that appears, make sure to select Maps JavaScript API, Geocoding API, and Places API.
In the next step, enter the name for your project (site).
You will be redirected to a Google Maps Platform page for setting up your billing information. Follow the wizard to complete registration.
Once your account billing is set up, follow the steps outlined in the official Google Maps documentation for getting the API key. If you already have existing projects using Google Maps API, please follow the steps in the official guide for existing users.
Creating an API key for Azure Maps
If you do not have an account for Azure Maps, go to the Microsoft Azure page and click the Start free button. Follow the wizard to create your account and set up your billing information. Once your account billing is set up, follow the steps outlined in the official guide for managing your Azure Maps account and keys.
Entering the maps API keys
Once you have the maps API key for your site, you need to enter it in Toolset settings. Go to the Toolset → Settings page and click the Maps tab. There, select which API you want to use and enter the API key.
Known Issues
Problems with displaying markers on Google Maps
If Google Maps API key is restricted by domain, that may not work for users with multiple domains or subdomains. To solve this, you can enter a second API key for Google Maps, in the Toolset settings. When added, this second key is used exclusively for server-side requests. This means it is never exposed in HTML and does not need restrictions. If you want extra security, you can restrict it, but only by IP addresses, not by domains.