2

I'm developing something with the Google Books API, but I think this can be generalized across many of Google's APIs.

Suppose I have an app that's got a social aspect where I can add friends and see their Google Books collection. From the API docs, it says I can retrieve anybody's collection if I know their userid, but I can't find any way to retrieve it programmatically. The only thing I can expect a user to know is their friend's gmail address (or Google Account Login, which, for these purposes, is the same thing). The only way I can somehow get it is through a URL on their web interface for Google books. Making users do it that way is an obscure form of torture.

Does anyone know if this is possible with any Google service?

Specifically, suppose I had a gmail address: example@gmail.com, could I then query some Google service to get the userid for that user? A userid is a basically a really big number (around 20 digits)

moinudin
  • 134,091
  • 45
  • 190
  • 216
ageektrapped
  • 14,482
  • 7
  • 57
  • 72
  • Where do you see this user id? Have you seen [this](http://code.google.com/apis/gdata/docs/auth/overview.html)? – moinudin Jan 16 '11 at 08:54
  • @marcog I assume you have a gmail address. When you're signed in, go to http://books.google.com/. On the left hand side, you should see a link called My Library. Click it. Now, look at your address bar. It should be of the form http://books.google.ca/books?uid=...&source=gbs_lp_bookshelf_list where ... is your USER_ID. You can take that number, and use it in API calls. You can give that number to somebody else, and _they_ can use it in API calls to see your bookshelf. I'd like to be able access my friend's bookshelves, but programmatically. – ageektrapped Jan 17 '11 at 18:24

1 Answers1

0

Here's a similar question with a solution/workaround from Nick Johnson:

The current workaround is to create a User object, store it to the datastore, and fetch it again. If the email corresponds to a valid Google account, the User object in the returned entity will have its user_id field populated.

Community
  • 1
  • 1
Jeff Swensen
  • 3,513
  • 28
  • 52
  • 1
    Creative. But that won't work for me. I'm not developing on a platform that allows python or Java code to run. And my app is not running on AppEngine. Another possibility that I tried was asking one service that can rely on either userid or gmail address. Pass in the gmail address and see if I can get the userid but they all consistently use what you give them. – ageektrapped Apr 28 '11 at 18:38
  • Write your own service that implements this simple workaround and lets you call it from whatever platform you're working on. – Jeff Swensen Apr 28 '11 at 18:40