2

I am not quite understand the meaning of "sortid" and "firstitemmsec" returned by the unofficial Google Reader API? Somehow, these values are used correctly in Google Reader web application. How do I make use of these values in my own application?

{
categories =     (
            {
        id = "user/16966160118879564357/label/iPhone";
        label = "iPhone";
    }
);
firstitemmsec = 1292000756920;
id = "feed/http://apple.com/feed/";
sortid = DF48A396;
title = apple.com;
}
Hoang Pham
  • 6,899
  • 11
  • 57
  • 70

1 Answers1

4

When a user subscribes to a feed, the most recent 10 items in it (or items in the past 30 days, whichever results in fewer items) are considered unread for that user. The timestamp (in milliseconds since epoch) of the oldest item that should be considered unread is stored in firstotemmsec. When requesting unread items from a feed, Reader passes in max(now - 30 days, firstitemmsec) as the "ot" (oldest timestamp acceptable) parameter, so that the backend doesn't look any further than that for older items.

sortid is used to maintain custom subscription/folder ordering. In the http://www.google.com/reader/api/0/preference/stream/list API response there is an "ordering" pref, which is composed of concatenated sortids of the items in that folder (items that are in that folder but don't appear in the "ordering" list are appended to the end).

For example, I have a "tech" folder that has 3 subscriptions in it, MacRumors, Ars Technica, and Hacker News. It has an "ordering" pref of "B2E0248117996C269955C28D". Sort IDs are 8 characters each, so this can be split to the sort IDs "B2E02481", "17996C26", and "9955C28D". If you maintain a map from sort ID to subscription, you can look up those IDs in it to know what order to display them in.

Mihai Parparita
  • 4,236
  • 1
  • 23
  • 30
  • hi Mihai, could you please explain in more detail how the sortid is structured? how to use that value? what does it mean "composed of concatenated sortids of the items in that folder"? – Hoang Pham Dec 13 '10 at 16:00
  • I added a more detailed description of the sortid and ordering fields. – Mihai Parparita Dec 14 '10 at 01:21
  • hi Mihai, I nearly got it, thanks for your answer. how about the preference/stream/list file, how is it structured, where is the documentation about it? Do you have any idea? – Hoang Pham Dec 14 '10 at 10:27
  • I found the answer: http://code.google.com/p/greader-unofficial/source/browse/wiki/ToDo.wiki?r=16 https://www.google.com/reader/api/0/preference/stream/list?output=json – Hoang Pham Dec 14 '10 at 10:33