How do I optimize the Google API logic

Checklist before starting

Note: You can no longer register for the Google Maps Platform premium option. It is also no longer available for new customers.

Control whether your team has access to the resources they need

Save your welcome letter for the Google Maps Platform premium option.

importance: The welcome letter is your starter kit and maybe even your first aid kit for the Google Maps Platform premium option. It contains important information such as your project ID in the Google Cloud Platform Console, your client ID, and your cryptographic key, which are required to use the premium option. It also contains all the information you need to contact the support team responsible for the premium option if you have technical problems with one of the Google Maps APIs.

Use the Google Cloud Support Portal

importance: The support portal provides access to information such as usage reports, news feeds and useful developer resources. You can also use it to submit support cases to the support team for the premium option if technical problems arise during development or market launch. The support portal can be reached via the following URL:

https://google.secure.force.com/

Before starting, all developers responsible for the maintenance and care of your application must be granted access rights to the support portal. In the event of technical problems, access to the support portal offers two advantages: the members of your team can contact the support and our support team can get in touch with the right contact person in your company. For example, the support team may need to contact your company if we discover unusual traffic or behavior that could affect your application. If we have the contact details of the developers in question, this could be decisive in ensuring that we can avoid an unforeseen downtime. Here you can request access authorization for the support portal:

Request an account for the Google Cloud Support Portal

Subscribe to email groups for notifications

importance: To keep you up to date with developments and changes to the Google Maps APIs, we recommend subscribing to one or more of the following email groups:

  • google-maps-platform-notifications: Technical updates on the APIs and web services of the Google Maps Platform, notifications in the event of failures and function announcements for the platform (approx. 3 to 5 messages per month).
  • google-maps-js-api-v3-notify: New versions of the Google Maps JavaScript API (approx. 4 messages per year)

Subscribe to relevant notification feeds

Note: The notification feeds are discontinued and replaced by the notification groups. Subscribe to the relevant notification groups to keep receiving updates.

importance: So that you are always up to date with developments and changes to the Maps APIs, we recommend that you subscribe to the relevant notification feeds. You can find a description of this in the FAQ.

You can also use the following RSS feed for Google Maps Premier API Announcements: Outages, Updates, Service Notifications subscribe to:

http://google.force.com/services/xml/MapsRSS

Have the support hotline number to hand

1-877-355-5787 for customers in the USA, +1 404-978-9282 for customers outside of the US

importance: You can call the Google Cloud support portal via the hotline. Save this page as a bookmark so that you always have the latest support hotline numbers to hand. You can report technical problems to our team via the support hotline. The hotline is only reserved for cases involving production outages or the unavailability of services. Our priority levels are defined in this document:

https://support.google.com/googlecloud/answer/184028

Optimize application

Configure the firewall to allow access to the Google Maps Platform services

importance: Google Maps Platform services use different domains, some of which are non-domain. If you are behind a restrictive firewall, it is important that the firewall allows access to the domains used by the individual Maps API services. If your firewall does not allow access to these domains, the API requests will fail, which can affect your applications. You can find a full list of domains used by the Maps APIs in the support portal:

  1. Sign in to the Google Cloud support portal.
    The support portal is only available to customers with the Google Maps Platform premium option or a previous license for Google Maps APIs for Work or Google Maps for Business.
  2. Go to tab resources.
  3. Choose the List of domains used by the Google Maps Platform family out. You can find the direct link here.
  4. Grant your applications access to the domains listed.

We do not recommend using IP addresses to manage firewall restrictions, as the IP addresses associated with these domains are not static.

Note: The Google Maps Platform services use ports 80 (http) and 443 (https) for inbound and outbound traffic. In addition, these services require GET, POST, PUT, DELETE and HEAD requests. Configure your firewall so that traffic can be transmitted via these ports and requests are allowed depending on the API and use case.

Load APIs using the correct SSL host name

importance: If applications load the Maps APIs over SSL, it must be done using, not the legacy hostname.

Authorize SSL domains for use with the Maps JavaScript API

importance: If the Maps JavaScript API is used with an SSL domain, it is important that you have explicitly authorized your HTTPS domains so that your requests are not rejected. Note: Authorizing does not automatically activate the corresponding SSL domain. You can check the list of authorized domains on the Google Cloud Support Portal by clicking the link in the navigation menu on the left Maps: Manage Client ID Click on (Maps: Manage Client ID). To troubleshoot errors related to using client-side APIs with an SSL domain, please first check that elements of your page are loaded via HTTP. For more information, see the instructions under Resolving Authorization Errors.

Note: As soon as your premium option has expired, the link to will no longer appear in the support portal in the left navigation bar Maps: Manage Client ID (Maps: Manage Client ID) is displayed. Click this link to access the Client ID Management Tool.

Select the correct API version

importance: Before developing your application, it is important to know which versions of the APIs are out of date. If you only use non-discarded API versions, you not only shorten the development time, but also reduce the follow-up costs that arise from discontinuing the discarded versions.

In particular, it is important that you understand the versioning scheme of the Maps JavaScript API so that you do not inadvertently use an unsuitable version of the API in your environment.

For example, it might make sense to use the experimental version of the API in your development or test environment, but we strongly advise against using the experimental version in a production environment. You should only use stable API versions in your production environment, as our SLA only applies to stable versions.

For more information, see the Maps JavaScript API Versions Guide.

Choose between client-side and server-side design

importance: Choosing a client or server-side approach is an architectural decision that is of paramount importance to the stability and expandability of your application. Essentially, a server-side approach should be chosen for pre- and post-processing of records that take place offline (i.e. outside of your application). In contrast, those parts of your applications where there is user interaction (i.e., where user requests are processed in real time) should take a client-side approach.

Providing a server-side approach to situations where a client-side approach should be used is the number one cause of over-quota and, therefore, non-functional applications. We strongly recommend that you familiarize yourself with geocoding strategies before developing or launching applications that rely on server-side calls.

Optimize quota usage

importance: If you understand how your application consumes quotas, called Maps APIs credits, you can reduce your costs. For example, if you use the Maps JavaScript API, your application will use Maps API credits for every map view. You can find information on this in the instructions on usage fees and limits for the premium option.

Manage usage of your web service quotas

importance: By default, the overall web service contingent is 100,000 daily free inquiries. For a more detailed quota breakdown by API, see the Usage Limits Guide. To find out how high the quota is available for your project, submit a support request.

Before starting your service, familiarize yourself with the quota-related error messages (e.g.,). Set up appropriate logic in your application to be able to react to such errors if you exceed your quota. First, read the FAQ on usage limits. For information on the status codes returned by each API, see the Developer Guide for that API, such as the Directions API Status Codes Guide. Understanding and implementing these concepts will greatly reduce the risk of your application exceeding your available quota, being blocked by Google, and / or experiencing errors.

Run stress tests on your app

importance: With a load test of your application, you ensure that high volumes of requests can be processed without exceeding your quotas for the Maps APIs.

Stress tests on Google's live services result in your application exceeding the allowed quota and being blocked by Google. Google Maps Platform can handle very high volumes. In 2012, “In the footsteps of Santa Claus” processed 1,600,000 requests per second. Therefore, it is not necessary to perform a stress test on Google services. Rather, a load test of your application is intended to ensure that your application can handle high request volumes without exceeding your quotas for the Maps APIs. For example, if your quota for the Geocoding API is 20 queries per second, a stress test should ensure that your application can process 600 queries per second without sending more than 20 queries per second to the Geocoding API.

To ensure this, the stress test should be carried out on a pseudo-API (Fake-API) - a service that without The inclusion of Google Maps Platform can accommodate a large number of inquiries and answer them with valid answers. This allows you to stress test your application without running the risk of being blocked by Google Maps Platform.

Take a look at this example of a pseudo API implemented as a small Google App Engine application. You can upload this example to your own App Engine application after registering at appengine.google.com. Then have your application send requests to that address instead of maps.googleapis.com.

The standard (free) quotas for the App Engine should generally be sufficient to load test your application well beyond your quotas for the web services of the Maps APIs. Your application needs to set the correct header to enable response compression. This is important to ensure efficient bandwidth usage, which is a critical requirement for an App Engine application that processes a high volume of plain text (JSON / XML) responses. If you need a higher quota for your App Engine application, you can also turn on billing, although that should rarely be required.

Migrate the application from a standard to a premium license

Include client ID or API key in API requests

Reason: One of the most important steps for your application is to include your Client ID () or API key in your API requests, which looks something like this:. The client ID or API key identifies your requests as requests to the Google Maps Platform premium option.

You have to include your client ID or your API key in your applications in order to be able to use all functions of the premium option. You will also need to provide your client ID or API key in order to be able to use our technical support and to ensure that your application is covered by our SLA.

For most APIs, you can choose to use a client ID or an API key. You can find your client ID in the welcome letter sent to the main contact (s) in your company. You can generate your own API keys with the Google Cloud Platform Console.

You can find detailed information in the instructions for authentication and authorization.

Include API key or client ID (not both) in API requests

importance: In order to load the Maps JavaScript API correctly or to send a request to other Google Maps APIs, you have to either the client id or insert the API key, but not both. If you want to use a client ID, you have to remove all parameters. If your request includes both a client ID and a key, unexpected functionality or errors may occur in the application.

For detailed information on the correct format of requests per API under the premium option, see the Authentication and Authorization Guide.

When using a client ID: Authorize domains for use with the Maps JavaScript API

importance: To prevent unauthorized websites from using your client ID, you have to authorize the domains of all websites that use your client ID for the Google Maps JavaScript API from our support team. If you use an API key instead of the client ID, no URL registration is required. If there is a mismatch between the authorized URLs and the website trying to use your Client ID, your website will not be able to use the API with your Client ID. You can authorize domains at any time. Therefore, before starting, make sure that you have authorized the domains for all of your websites.

You can check the list of authorized domains on the Google Cloud Support Portal by clicking the link in the navigation menu on the left Maps: Manage Client ID Click on (Maps: Manage Client ID).

If you experience problems with authorization, we recommend reading the Authorization Troubleshooting Guide before filing a support case.

When using a client ID: Sign web service requests with a signature generated with your private cryptographic key

importance: Your private cryptographic key is used to create digital signatures to generate