Search code examples
google-reader

Getting list of tags for a user from google reader api


Form this blog post i see that once you know the tag name you can items in the tag by

/reader/atom/user/[user id]/label/[tag]

But how do i know what tags are available for the user ? How can get the list of available tags for a user from google reader api .

I've seen third party apps do that, not sure how they are doing it .


Solution

  • You'll need to use the List API which requires you to be authenticated as the user for whom you want the tags. To authenticate you'll need an SID and a token. To get these, first send a GET request to https://www.google.com/accounts/ClientLogin?service=reader&Email= [your Google username] &Passwd= [your Google password]

    which will return an SID, LSID and a UserID in the format key=value\nkey=value\nkey=value. You only need the SID.

    Now you want to put the SID into a cookie that looks like Name: SID Value: [your SID] Path: / Domain: .google.com

    Now using this cookie send a GET request to http://www.google.com/reader/api/0/token which returns your token in plain text. You won't actually need a token for this particular method but it's useful to keep.

    The List API method for grabbing a list of tags is http://www.google.com/reader/api/0/tag/list?output=json&ck=1250374215987&client=scroll

    which will return a JSON formatted list of tags. The ck argument is the current Unix time, so set it appropriately.

    For more detailed information on authenticating with the Google Reader API have a look at my recent blog entry on the topic.