API discussion

Development-related discussion, including bundled plugins
User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

API discussion

Postby fox » 03 Nov 2010, 22:07

Let me start with one thing - I have just noticed that API doesn't seem to update ccache properly. Which means using API clients might cause counter desyncs with tt-rss proper. Which is Bad(tm).

nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 04 Nov 2010, 00:21


User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 04 Nov 2010, 01:09

Yeah, if anything modifies the counters in any way (which means primarily changing unread status of articles) it might invalidate counter cache for affected feeds. I think only one method in the API actually changes anything, so it's not a big deal.

Modified login is already in, I don't think there's anything to discuss there, as long as it works. I'm still not all that hot on bulk downloading of stuff (well, we talked about it a lot) but I really don't have anything better which won't involve extensive rewrites of your application. :)

E.g. the API client workflow I had in mind was something like that (I guess it's not surprising since that's mostly how tt-rss works)

- init, etc
- request the headlines list as selected by user
- download the headlines, receive headline IDs, start fetching loaded article data in background in case user clicks on something
- rinse, repeat, view another feed

You went there another way around which somewhat better (you might have stuff preloaded which you haven't seen in the headlines) and somewhat worse (you can have stuff cached which you won't realistically click on). Am I making sense?

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 05 Nov 2010, 15:45

One more thing, I'd like the getCounters method to use getAllCounters() which is now refactored to return JSON-able data. The data format is somewhat different from the one you chose to use, so either you'll need to slightly update your app (the changes should be minimal) or we'll need to massage data in the API handler to maintain compatibility. Personally I'd prefer doing the former for maximum data format unification in tt-rss.

nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 05 Nov 2010, 17:17


User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 05 Nov 2010, 18:02

I have actually tweaked the counter functions a bit to present more logical format (cat: true -> kind: "cat"). If kind: is not defined, assume it's a feed of some sort. Anyway, since you're okay with this, I'm changing getCounters to use getAllCounters(). :)

Also, I'm seeing a bug there: feed icon checking (e.g. has_img:) doesn't work properly, probably because api/index.php is in a different directory and PHP is too stupid to figure this sort of thing out.

Feed IDs can be a bit confusing. Feed 0 is Archived, category 0 is Uncategorized. Category -2 is Labels, Feed -2 is, um, I dunno. Published, I think. There should be a list of IDs somewhere on the wiki, likely on the API page.

We can definitely leave the API calls undocumented (which would mean unsupported as far as I'm concerned). So when better ideas surface, we'll be able to phase them out. By the way, tt-rss already has a mostly working download/sync interface for its offline mode. Although it's not public at the moment and uses the internal RPC server but this is something that we can change.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 08 Nov 2010, 19:45


nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 09 Nov 2010, 00:25


User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 09 Nov 2010, 09:34

Check the "download" method in backend-rpc and, I guess, offline.js. The whole thing is somewhat weird but it kinda works. :)

Edit: API sequence thing is done in trunk.

Edit2: Have fun on your vacation! :)

nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 30 Nov 2010, 17:11

Hi there, i'm back from vacation. Was a nice trip, Tenerife has 25°C and beach, really nice :)

Back to business. I implemented the necessary changes to read from the new API and as far as i can see it hasn't changed since then. Do you have any plans about when you will publish the new version of Tiny Tiny RSS? I figured I can't make my reader support the old AND the new API at once without further trouble so I cleaned out the old methods. But this leads me to the problem that i can't release any new version until the server is updated...

Greetings,
nils

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 30 Nov 2010, 18:03


nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 16 Dec 2010, 08:10

Just a short notice as i spent a while debugging: There is a typo in the API-docs on catchup feeds (http://tt-rss.org/redmine/wiki/tt-rss/J ... atchupFeed), the second parameter is called "category" (not "is_cat").

Greetings,
nils

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 16 Dec 2010, 09:47

Yeah, it should be is_cat like the rest of the methods. Also, getArticles uses is_category. Changed both to is_cat for consistency. :)

nils.braden
Bear Rating Trainee
Bear Rating Trainee
Posts: 43
Joined: 25 Oct 2010, 12:12
Contact:

Re: API discussion

Postby nils.braden » 25 Dec 2010, 12:30

Hi,

Merry Christmas btw. :)

Just had a problem yesterday, someone doesn't get a session_id (it is null when automatically assigned but calling with ...sid=asdf seems to work. Should i just create a session-id on the device or do you have any idea what the problem could be? The link to the issue is here: https://code.google.com/p/ttrss-reader- ... tail?id=35

Greetings,
nils

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: API discussion

Postby fox » 25 Dec 2010, 16:32

No idea. Session id can't really be null unless something is seriously broken with his PHP session settings. I'm not sure setting arbitrary sid is a good idea, you are supposed to get this from the server. If the server is broke, I suggest fixing it, not hiding the problem.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 3 guests