Do I need to get API Key for Google Book search - google-books

I am little bit confused interpreting the Google Book API terms. In this page it is written that
Note: Performing a search does not require authentication, so you do
not have to provide the Authorization HTTP header with the GET
request. However, if the call is made with authentication, each Volume
will include user-specific information, such as purchased status.
Does that mean I don't need to use an API key for searching book info or linking cover from google books (to be used in Android App)?
Thanks

For searching only the informations about books (author, title, etc..) you can write code without have any API key. But probably for the payment service or other (write a book and insert that in google book api) you should have an API Key (with sign up).
Bye bye

For searching only the informations about books (author, title, etc..) you can write code without have any API key. But sometimes google books API gives back HTTP 403. HTTP Status Code 403: The server understood the request but refuses to authorize it. So it is advisable you use the API key generated and also try to mention your country code in it. As sometimes it fails to recognize where the request is coming from so it gives you access denied (403) error.
https://www.googleapis.com/books/v1/volumes?q=intitle:${bookTitle}&key=${googleKey}&country=${countryName}
This query was used by me in a React application as sometimes without key or country name i got HTTP 403 error. countryName is of the form US or UK, etc.

Related

How to get Google's Last Crawl Date for a given URL of mine via the API

Given any URL of a site I "own", in Google Search Console I can see this information:
I am particularly interested in the "last crawl date".
How do I get the same information with the API (Search Console API or Webmaster Tools API)?
You cannot. Not via the Google Search Console API, the Webmaster Tools API, or any other Google API for that matter. How Google can design their APIs so poorly is beyond me. Providing access to 100% of the features that you can access through the UI of the same service, is the #1 most basic requirement of an API, and they fail even at that.
There's this workaround (requesting https://webcache.googleusercontent.com/search?q=cache:<YOUR_URL>... and scraping the response contents), but you'll start getting "429 too many requests" pretty soon, so it's basically useless unless you only need to make, I don't know, maybe a request every few days.
In practice, there doesn't seem to be any other way than logging the crawler's visits yourself (recognizing it from the user-agent string, validating the IP maybe with a reverse lookup or just against a list).

How to get access_token for replying review in Play Developer API?

This link: Reply to Reviews describes the way to retrieve and reply to reviews. The Google Play Developer Reply to Reviews API allows us to view user feedback for our app and reply to this feedback. But I am finding it difficult to get the authorization token. It says I should have got this when I get access to the API.
But after going to the link, I didn't find too many information on this, rather, it has another link which takes me to the page where I have already created a service account.
After summarizing, my question is - I have created a service account and downloaded the key as JSON. But how to get this access_token the given snapshot asking for? The JSON file itself doesn't contain such access_token, rather it contains other information including type, project_id, private_key, client_id etc.
The process is not described directly in the link given in the question. Rather we will follow the steps mentioned in Play Developer API | Authorization
The whole process actually has two major steps:
Making a OAuth 2.0 client ID and downloading it.
Using client_id, client_secret and redirect_uris from this download JSON file to make API call.
Making OAuth 2.0 client ID and getting parameters
In order to do this:
Go to Google Play Console.
Use your play console account to login into it.
Make sure the right project is selected, at top there is a drop-down, where the correct project is supposed to be selected.
Now from + CREATE CREDENTIALS button create a OAuth Client ID and after successful creation you will find it listed under Credentials tab. The Credentials tab is at the left side of the page.
Now download the OAuth Client ID and it will be saved as a JSON file.
Open the JSON file and collect the client_id, client_secret and redirect_uris from there. Here redirect_uris will contain a list of URLs. One of them is http://localhost, we don't need it. Please take the other one, somewhat like urn:ietf:wg:oauth:2.0:oob.
Now the second step begins:
Make the API call
Now go to the first link I provided in the answer, i.e: Play Developer API | Authorization. We just did the first step under initial configuration. Now the second step begins. Make sure you are using the same browser where you are already logged-in on Google Play Console.
Now fill-up the fields in this link as mentioned in the documentation
with the information we just got (client_id, client_secret,
redirect_uris), remove the ... and put your redirect_uri and
client_id there:
https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/androidpublisher&response_type=code&access_type=offline&redirect_uri=...&client_id=...
Now after filling up your credentials in this link provided paste this link to browser and go to this URL.
This may require you to authorize this request by signing in with your account (with the Google Play Console Account we are using so far).
After authorization you will be given a code parameter similar to 4/eWdxD7b-YSQ5CNNb-c2iI83KQx19.wp619..... (This is also mentioned in the documentation you may follow the steps there).
Now go to the step 4 in the documentation (following is a snapshot):
replace the credentials which are here inside <..> (including < and >) with the information we so far collected. Here <the code from the previous step> is nothing but the code parameter 4/eWdxD7b-YSQ5CNNb-c2iI83KQx19.wp619.... we got.
Now make this API call. To make this kind of API calls you may need to use Bulk edit of Postman software (download and install the software). But if you are not comfortable with this Bulk edit, I am giving you a similar form data in the following snapshot. Just fill up the fields there in Postman and make the API call, (Please note that the method is selected POST):
Also you need not change the grant_type (its value is authorization_code).
Now clicking Send you should get the response which will contain access_token. Following is a snapshot of the response that comes with the access_token we are looking for (snapshot got from the documentation):
This response will come only once (for a certain code), to get another response you may need another code. So, save this response as a JSON from Postman to use it further.
Now you are done! Use this access_token and make API calls to get reply to reviews. More details here. Also please note that you might not get any reviews at all with this call, as this reviews' responses only work for recent time. If you make some recent comment in Play Store under your desired app they will be returned but the older comments will not be returned as response and the response might be blank {} if there are no recent comments. As mentioned in the documentation:
Note: You can retrieve only the reviews that users have created or modified within the last week. If you want to retrieve all reviews for your app since the beginning of time, you can download your reviews as a CSV file using the Google Play Console.

difference in API/session in Google API billing

Not able to differentiate between price per request and price per session in Google API
I'm facing difficulty in
understanding some billing related terms for Google API. I know, this question might be more suited for support directly from Google. I tried but not getting satiesfactory response.
I was going through this URL:
https://developers.google.com/maps/billing/understanding-cost-of-use#ac-per-character
Here both 'price per request' and 'price per session' has been provided.
While I understand the difference between request and session, my question
is related to example provided in the same link, which is like this :
Places Autocomplete Request (input=”paris”, session_token: XYZ)
What I know, in google API, we just pass an API KEY to get results, but above seem to have required session_token. This has confused me. How can I pass session_token, when google has provided just an API KEY to me after creating billing account?
Is API key same as Session_token or does that mean, I need to get session token after 'first' passing API_KEY via code.
I'm not able to find good example explaining this till now.
Thanks for your help !!

My Google API keeps returning a limit reached error, when I am sure I am under the limit

I am currently building a NodeJS backend app that is querying the Google Calendar API. I have setup a new project on Google Cloud API platform and have generated all the required credentials. As stated by the google calendar API page, the allowed queries per day is 1,000,000. Since I am only querying for testing purposes at the moment, I am sure that I haven't even hit a 100. Yet whenever I try to query the API it returns the error:
"The API returned an error: Error: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
Also I have noticed that the dev console has generated a API key for me. Where am I supposed to put that?
My initial thinking is that Google API requires me to perform an additional signup using some CLI tools or something along those lines to signup. If not, where am I supposed to sign up?
Thanks in advance.
Note: I already have all the information from the cloud platform such as client_id, client_secret, project_id.
In "Error: Daily Limit for Unauthenticated Use Exceeded", they key word is Unauthenticated. Your request to the Calendar API is missing an OAuth Access Token. You will need to research Google OAuth.
This question has been answered many times. Please learn how to search SO for similar questions whenever you post a new question. https://stackoverflow.com/search?q=google+oauth+%22daily+limit+for+unauthenticated%22
To anyone who comes across this post in the future. I fixed the issue by using the project generated by Google Calendar API site (https://developers.google.com/calendar/quickstart/nodejs) by clicked the big blue "Enable the google calendar api" and then changing the name of the quickstart project that was generated. I don't know why it works now but it does and it's been working quite stably so far. Lets see how to goes.

How can I log into gmail in a script/program using HTTPS?

My teacher has given me as an assignment to log into gmail and then send one e-mail or read the list of unread e-mails, but I can't use IMAP/POP3/SMTP or anything that isn't HTTP or HTTPS. I've tried looking for libraries in Ruby/Java to do it but nothing really worked for me.
I tried looking at the gmail source code page but I couldn't really understand what was going on. The page seems to call a post method on a link, but sniffing the packets what I saw was a GET apparently using a session generated using the info I send. So sending it "raw" didn't work either.
I've no idea what to do now.
After you authenticate with OAuth, you can get unread emails via an atom feed.
URL to hit: https://mail.google.com/mail/feed/atom/[<label>]
You can toy around with this at the Google oauth playground. Get an access token by continually clicking buttons and authenticating, and then hit discover feeds.
If you want a Java OAuth library, signpost is really good. You'll need to read the google documentation on its open authentication scheme. Specifically, you need to pass a scope query parameter when you attempt to authenticate. This is nonstandard, and it will trick you up if you're not looking for it.
If you're confused about OAuth or why its necessary, you may want to check out this resource.
Check out httplib2—it has (among other things) Google Account Authentication.

Resources