Getting a Google API Key

Note that Google changes the interfaces of its platforms frequently, so the screens shown may not be up-to-date. I am tired of nonstop updating my slides. You should be able to figure it out by playing with the platforms.
Two related Google pages are introduced as follows: To use the Google Maps JavaScript API, you must get an API key which you can then add to your mobile app, website, or web server. The API key is used to track API requests associated with your project for usage and billing. The following steps are from the Google’s Get API Key:
  1. Go to the Google Maps Platform.
  2. Enter the page Google Maps Platform and click the button “Get started.”


  3. Set up Your Billing.




  4. Select a Project or Enter a New Project.


  5. Enable Your APIs.
  6. Select the products, Maps, Routes, Directions, and Places:


    Another way to create an API key is from the Navigation menu, select APIs & Services ⇒ Credentials. On the Credentials page, click Create credentials ⇒ API key. The API key created dialog displays your newly created API key.


  7. Restrict the Key’s Usage.
  8. Restrictions prevent unauthorized use and quota theft. Application restrictions specify which web sites, IP addresses, or apps can use this key. You can set one restriction type per key. On the API key page, under Key restrictions, set the Application restrictions.

    • Select HTTP referrers (web sites).
    • Add the referrers (follow the instructions).
    • Click Save.


  9. Add the API Key to Your Request.
  10. When loading the Maps JavaScript API, substitute YOUR_API_KEY in the code below with the API key you got from the previous step:

       <script async defer 
         src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
         type="text/javascript" />


      “The second day of a diet is always easier than the first.    
      By the second day, you’re off it.”    
      — Buddy Hackett