https://console.cloud.google.com/apis/dashboard
If we open google console we see how many requests per every service has been done. Is there any way to export these counters? I was not able to find any API which is responsible for these counters.
Get google maps api usage info
Detect Google Maps Javascript API limit for map loads
Many years passed, still no way to setup alerting for API usage? If there is no programmatic access may be there is some way to setup alerts when API usage is above threshold?
As mentioned by the first answer, there's no such API to monitor these usages but there are couple of ways to monitor your usage which are:
Setup Budget Alerts, this will trigger notification if you've reached a certain amount of your specified budget for a month, but please note that this will only notify you and will not actually stop the usage after the specified amount.
If you would like to monitor or get an overview of your daily usage, you may implement what we call channels with the help of BigQuery Export. This will give you a breakdown report of daily usage. The standard SQL code you can use to retrieve such report using the BigQuery export is:
SELECT Date(usage_start_time, "America/Los_Angeles") AS billing_day,
invoice.month AS invoice_month,
service.description AS service,
sku.description AS sku,
(
SELECT l.value
FROM Unnest(labels) AS l
WHERE l.KEY = 'goog-maps-channel' ) AS goog_maps_channel,
Round(Sum(usage.amount), 2) AS usage_amount,
usage.unit AS usage_unit,
Round(Sum(cost), 2) AS cost,
cost_type,
currency
FROM `PROJECT_ID.DATASET_NAME.gcp_billing_export_v1_BILLING_ACCOUNT_ID`
WHERE invoice.month = '201906' -- Change the invoice month with the same format as the example.
GROUP BY billing_day,
invoice_month,
service,
sku,
goog_maps_channel,
usage_unit,
cost_type,
currency
ORDER BY billing_day,
service,
sku
You may learn more on how to setup the BigQuery export here.
If you want to restrict your usage up to a certain amount per day, you may also implement the Capping of API usage wherein it will only allow an API to call a specific amount of requests per day.
If you would ever need help in the correct calculation of requests per day for each API to be on a certain budget, you may reach to the support team of the Google Maps Platform APIs here.
Related
i'm trying to retrieve the number of subscribers, but the number that I received was rounded, not correct number.
By seeing the API docs, it is impossible to get exact subscribers number throughout youtube data API. So, I came up with the idea that using Analytics API, However there is no way to fetch the number of subscribers. Is there any way to do this?? thanks.
(It is possible to see the subscribers number by opening youtube but I can't do this throughout API)
These are the only metrics that the analytics api provides:
annotationClickThroughRate
annotationCloseRate
verageViewDuration
comments
dislikes
estimatedMinutesWatched
estimatedRevenue
likes
shares
subscribersGained
subscribersLost
viewerPercentage
views
Source: https://developers.google.com/youtube/analytics/metrics
Also See: https://stackoverflow.com/a/63537230/12772716
You can get the current subscribers via the YouTube Data API:
https://developers.google.com/youtube/v3/docs/channels
under statistics.subscriberCount
Additionally you could calculate the historical subscribercount by combining YouTube Data and Analytics API:
subscriberCount - (SUM(subscribersGained) - SUM(subscribersLost))
I've set up two sets of address. One across the second row starting at B2 and another down the first column starting at A3. Using a custom function invoking google's api I am trying to get a list of drive times in minutes for all locations in the first column to all locations in the second row. I get an error stating that it has ran to many times in one day. Here is the custom function
function DriveTime(origin, destination) {
var directions = Maps.newDirectionFinder()
.setOrigin(origin)
.setDestination(destination)
.getDirections();
return directions.routes[0].legs[0].duration.value/60;
}
Error: Service invoked too many times in one day: route (line 2)
I understand the error, but how many times in one day can I make this call as a standard free user. And where can I find pricing to increase the amount of daily calls to this service?
Also if anyone knows of a way to accomplish this in less calls than I am attempting, that'd be welcomed knowledge as well.
Technically, your quota as a apps script user without API key/Billing information should be zero. But for whatever reason, Google didn't make changes to charge apps script Maps library when they changed the pricing back in June'18 for everything else related to Maps API. There seems to be a default quota, which is not explicitly mentioned in apps script documentation pages.
If you have had premium plan in the past, you can leverage Maps.setAuthentication(). But if you do not,
This method doesn't work with API keys. Additionally, please note that Premium Plan is no longer available for new customers. If you don't already have a Premium Plan license, please don't call setAuthentication(clientId, signingKey). You are able to use the Maps methods with the default quota allowances.
Which means you cannot extend the default quota allowance.
Your alternative would then be to call the maps api directlyskip oauth using urlfetchapp and parse the response using apps script vanilla javascript(es5).
You can see the pricing here.
Quick question, just to clarify the wording and meaning (because it's changed a couple of times for Map loading...)
There are the two following statements in the Places API FAQs:
The Google Places API has the following query limits:
Users with an API key are allowed 1 000 requests per 24 hour period.
Users who have verified their identity through the APIs console are
allowed 100 000 requests per 24 hour period. A credit card is required
for verification, by enabling billing in the console. We ask for your
credit card purely to validate your identity. Your card will not be
charged for use of the Places API. While the lower limit is sufficient
for development and testing, we recommend enabling the higher limit
before launching your application. It is possible to request an
additional quota. If granted, the additional quota is free of charge.
If, at some stage in the future, an option becomes available to pay
for an additional quota, that quota will be over and above the
existing free quota, and you will need to sign up for it explicitly.
Note that some services may have a multiplier:
The Text Search service is subject to a 10-times multiplier. That is,
each Text Search request that you make will count as 10 requests
against your quota. The Radar Search Service is subject to a 5-times
multiplier. That is, each Radar Search request that you make will
count as 5 requests against your quota. If you've purchased the Google
Places API as part of your Maps API for Business contract, the
multiplier may be different. Please refer to the Google Maps API for
Business documentation for details.
This implies that use of the Google Places API is restricted to 100,000 queries per day, or 10,000 if you're doing a Text Search.
However, on the Uplift page, it says the following:
If you are developing a web based application that only needs to
search for places, and is not submitting new places or Place Bumps,
you should use the Places library of the Maps API rather than using
the Places API web service. The Places library assigns a quota to each
end user rather than to each key. This means that your available quota
increases with your user base rather than being capped at a fixed
amount.
I am using the Places API in the following way:
https://maps.googleapis.com/maps/api/js?key=XXX&libraries=places
...
service = new google.maps.places.PlacesService(map);
service.textSearch(request, callback);
And also for some details searching and photo searching.
Therefore my question is; Given my usage of the Places API, am I subject to the 100,000 queries limit on my app, or am I essentially uncapped at an app level, as my quota is per end-user? (i.e. per unique IP? if I had 10,000 users I have an effective quota for my entire user base of 100,000*10,000?)
EDIT:
For clarity: if I throw my API key into https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=XXXX, it will increment my Places quota count on the Google API console, however if I run queries through my JS app, I see no quota use change. I want to make sure that i'm not suddenly going to be hit with a massive quota result.
Use of the JavaScript API services, like those provided by the Places library, have quota assigned to each end-user. It's a very similar setup as objects like the google.maps.Geocoder, which has been discussed in a bit more detail in this Geocoding Strategies article.
You may apply for an uplift to the quota so that the restriction is taken away and you have unlimited access:
https://docs.google.com/forms/d/18pkOdu0uofeI8tbQoReDVfkbOIAscLvjiKc9ZP06hEM/viewform
This form is applicable to Android, IOS and Web.
We have a page that accepts a city, state combination or a zip code. Upon submit, it passes that information to the Geocode Webservice for Google Maps and returns a list of store location results based on the information passed. We sporadically have issues with bots hitting that page multiple times and then Google shuts down our usage of the geocode webservice for the day. Is there a way to ask Google to restore this more quickly? How should we handle this?
Use the client-side geocoder, the limits there will be based on the client not the server.
Geocoding Strategies
As specified on in the documentation, "Use of the Google Geocoding API is subject to a query limit of 2,500 requests per day (User of Google Maps API for Business may perform up to 100,000 requests per day.)"
There's a nice article on Geocoding Strategies which discusses caching and other options to optimize geocoding. The "Quota Considerations" section should be useful.
Remember to use client-side geocoding if at all possible, so that the quota limit will be counted per client, instead of per service/server. If you're still hitting the limits, you might need to go for the Business version and pay for a larger limit.
The following are the usage limits as specified by Google on their Developer Guide pages:
Google Maps JavaScript API v3 => For-profit web sites are permitted to generate up to 25,000 map loads per day
Google Geocoding API => subject to a query limit of 2,500 geolocation requests per day
Google Maps API for Business => may perform up to 100,000 requests per day
Am trying to evaluate using any one of the above for use with Visualforce on Salesforce.com (SFDC) platform [*]
I understand for a public website the requests are per IP. Now for SFDC, there could be many different Organizations on a particular server (say, NA1). So, two different companies using SFDC and Google Maps API could have an URL at https://na1.salesforce.com/something_here and their requests should be counted separately.
Will it be so? What will happen in case of each API?
[*]SFDC is a SaaS cloud for the purpose of our discussion. All users login through the same page but they could be logged into different "orgs"/"organizations" but their URLs might look similar
It's important to differentiate between the server-side and client-side limits here. The server-side geocoding api would have have the 2500 limit enforced across the shared Salesforce instance based on how many machines the requests come from (I assume NA1 isn't 1 huge server). Multiple organization using the free geocoding API would all share the same server-side geocoding limit. I've actually run into the same limits using Google's own App Engine platform, where a bunch of applications share the same outbound IP address.
For any sort of guaranteed performance you'll need to send the queries from your own server or go the Maps for Business route which lets you authenticate your queries to get those higher limits.
Client-side geocoding via the JavaScript API doesn't have these server-limits, so if users do any sort of action to trigger a geocode or two using the JS API is the best route.
You can already create your own "bucket" to track your 25K map loads per day by signing up for an API Key.
This question on SO addresses the geocoding API specifically being run from a visualforce page directly, Salesforce: Google maps query status 620 G_GEO_TOO_MANY_QUERIES and it does seem to mean that without a key the limits are shared. I would suspect that unless you plan on giving the app away that you are working on, you will pretty much be forced to pick up an upgraded API key. One thing you may want to look at to work around this is hosting the maps portion in another location, and iframing it into Salesforce.