views:

42

answers:

1

I am trying to retrive a single selected item from the google reader api. Is there an api call I can make to get an item by Id or do I have to access that items feed and get it from there?

+3  A: 

You can use POST to http://www.google.com/reader/api/0/stream/items/contents using i= as the input (you can repeat the i= parameter to get multiple item contents).

Here's a sample curl invocation:

$ curl -d "i=tag:google.com,2005:reader/item/1bab1bbe8a8ad82f" http://www.google.com/reader/api/0/stream/items/contents
{"direction":"ltr","id":"feed/http://googlereader.blogspot.com/atom.xml","title":"Official Google Reader Blog","description":"News, tips and tricks from the Google reader team.","self":[{"href":"http://www.google.com/reader/api/0/stream/items/contents"}],"alternate":[{"href":"http://googlereader.blogspot.com/","type":"text/html"}],"updated":1275437593,"items":[{"crawlTimeMsec":"1275437593933","id":"tag:google.com,2005:reader/item/1bab1bbe8a8ad82f","categories":[],"title":"Folder and tag renaming",

The output format is JSON by default, you can add a output=atom parameter to switch it to Atom.

Mihai Parparita
awesome thanks man. Out of interest where did you find that?
Luke Lowrey
I used to work on Google Reader :)But this is how search and sort by magic work (they get a list of item IDs, and then fetch their content). Peeking at the HTTP requests while doing those operations in the UI would reveal this request.
Mihai Parparita