Youtube Data Api multiplies by 2 your queries - json

This is a question most suitable for Youtube API developers.
Having 2 queries performed to get the videoid and the title (first query)
https://www.googleapis.com/youtube/v3/search?safeSearch=moderate&order=relevance&part=snippet&q=".urlencode($q). "&maxResults=10&key=". $api;
and a second query to get the contentDetails to see if the video is licensed or not
https://www.googleapis.com/youtube/v3/videos?part=contentDetails&maxResults=10&id=".$vid."&key=". $api;
I was expecting the Google dashboard to show 2 queries, instead it shows a 4 queries.
I'd like a clue as to how google counts this searches. Anybody has checked this behaviour?

I want to clear something regarding your issue. If your API requests returns multiple pages of results, this will add to the query as stated from here.
Note: If your application calls a method, such as search.list, that
returns multiple pages of results, each request to retrieve an
additional page of results will incur the estimated quota cost.
It is due to requesting again a token for another result per page. You can also check the Youtube Quota Calculator documentation for more details.
If this is not the case, this can be a bug. You can try to log the issue here.

Related

Pagination when data source is supporting multi page requesting

Does Google Data Studio Community connector support pagination?
I work with an external data service. The service returns data page by page. It requires start and next parameters and it requires 2 req/sec. Can I override a method like getData or upgrade request argument for implement this feature?
If it's not. Is there the best practice for getting data of this kind?
Community Connectors do not support pagination for web APIs at present.
The best practice would depend on your use case. If you want to get the full dataset for user, you can make multiple UrlFetch calls to get the full dataset, merge it, and return the merged set as the getdata() response. It might also make sense to cache this result to avoid making a large number of requests in the short term. You can cache using Apps Script cache, or a Sheet, or even to BigQuery. Keep in mind that Apps Script has 6 min / execution limit.
However, if you want to return only specific pages, the only way to configure that would be through getConfig since configparams are passed with the getData() request. Example use case would be returning only first n number of pages where n selected by user in the config.

Increasing quota limits - conditions to meet

We'd like to extend our quota limit from 1kk to around 20kk. We were already hitting limits, so we lowered frequency of our requests, and submitted https://services.google.com/fb/forms/ytapiquotarequest/. We have filled the from thoroughly and sent it three times, always with negative response from google:
Your quota extension application cannot be processed at this time
because of the following reasons:
Bad data (invalid project number)
As it says in the form:
The project number is a series of digits that can be found alongside
the Project ID in your Google Cloud Console. Please comma separate
the project numbers without additional spaces
There is only one numeric Project ID we have. When I tried fill in the alphabetic one, we received :
Project ID supplied does not exist.
When contacted Google Cloud Support, they told us that it is probably some bot who is answering this request, hence the generic answer. As well they directed us here: maybe someone of you had similar problem?
Perhaps they wish you to use the item the arrow is pointing at in the image below.
Go to Iam & Admin >> Settings

Google Place Reviews API - Photos return 403 on pageload

I'm currently using the Google Places API to pull reviews onto a webpage. Everything is working fine except for the Photos of the people leaving reviews. When trying to get the photo of the reviewer, it's returning a 403 Forbidden on every other page load. It seems that there might be a rate limit perhaps?
The problem is I can't find any documentation about rate limits and how to get the picture to display without issue. Am I missing something in the docs?
My API call is this;
https://maps.googleapis.com/maps/api/place/details/json?placeid=PLACE_ID&key=API_KEY
That returns quite a long JSON array (I've cut it down). One of those fields is;
{
"result" : {
"reviews" : [
{
"profile_photo_url" : "//lh5.googleusercontent.com/url/photo.jpg"
}
}
}
}
Like I said, if I refresh a couple of times it'll cause a 403 error for the images get request. Anyway to cache or allow more requests?
I found out why this was happening. It's to do with rate limits on the photo media which is why it was giving a 403 error in the console. The developer docs outline the limits for the media requested.
An excerpt of the docs...
The Google Places API Web Service enforces a default limit of 1,000
free requests per 24 hour period, calculated as the sum of client-side
and server-side requests. If your app exceeds the initial limit, the
app will start failing. You can increase this limit free of charge, up
to 150,000 requests per 24 hour period, by enabling billing on the
Google API Console to verify your identity. A credit card is required
for verification. We ask for your credit card purely to validate your
identity. Your card will not be charged for use of the Google Places
API Web Service.
Best thing to do is to cache the media once it's requested to avoid going over the limit which is especially useful if you're reloading the page lots of times for testing local development changes.

How do I get the execution time for Apache drill using rest api?

I want to get the total query execution time for Apache drill using some rest API or if any other method is available.
You will find information regarding execution time in Profile.
To get the profiles of running and completed queries.
Make a GET request to http://drill_host:8047/profiles.json
To get the profile of the query that has the given queryid.
Make a GET request to http://drill_host:8047/profiles/{queryid}.json
Check Drill docs for more details.

google documents api pagination

I am using google documents API. I need to implement pagination.
I used like below.
First page:
qry.setMaxResults(10);
qry.setStartIndex(1);
Second page:
qry.setMaxResults(10);
qry.setStartIndex(11);
I am getting same 10 results for second page also.
This question has this as answer link.
I am unable to find any answer in this link.
Can any one help me?
Thanks in advance..
The Documents List API uses "next" tokens for pagination and not the start index:
https://developers.google.com/google-apps/documents-list/#getting_all_pages_of_documents_and_files
To retrieve all pages of documents, you start from the beginning and then follow the link with rel=next to get more pages.
The max results parameter is used to limit the number of elements in each page.
Remember you can (and should) also use the newer Drive API to perform the same task:
https://developers.google.com/drive/v2/reference/files/list