2010-07-28 50 views
2

我試圖從google閱讀器api中檢索單個選定的項目。是否可以通過ID獲取某件物品的API調用,還是必須訪問該物品的Feed並從中獲取?Google閱讀器API獲取單個項目

+0

嗨! 現在我不能使用Mihai Parparita描述的方法。 我得到405錯誤響應。谷歌否認這一點? 你知道其他方法嗎? 謝謝! – 2011-01-30 21:51:38

+0

@Evgeny,截至今天,它似乎工作。只要確保使用POST獲取該URL而不是GET。 – 2011-03-07 14:11:44

回答

8

您可以使用POST到http://www.google.com/reader/api/0/stream/items/contents使用i =作爲輸入(您可以重複i =參數來獲取多個項目內容)。

這裏的一個樣品的捲曲調用:

$ 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", 

輸出格式是JSON通過默認值,可以添加一個輸出=原子參數,將其切換到原子。

+0

非常感謝的人。出於興趣,你在哪裏發現? – 2010-07-28 23:50:00

+0

我曾經在谷歌閱讀器上工作:) 但是這是如何搜索和按魔法工作排序(他們得到的物品ID列表,然後獲取他們的內容)。在UI中執行這些操作時窺視HTTP請求會顯示此請求。 – 2010-07-29 20:03:37