API problem with nested categories

Support requests, bug reports, etc. go here. Dedicated servers / VDS hosting only
meinfuchs
Bear Rating Trainee
Bear Rating Trainee
Posts: 22
Joined: 22 Mar 2013, 13:58

API problem with nested categories

Postby meinfuchs » 24 Mar 2013, 14:11

Hi,

I think the api might have a problem with nested categories: If a category contains only other categories but no feed, it is not returned by getCategories.

Lets assume the following structure,:
  • category A
    • category B
      • feed 1
    • feed 2
  • category C
    • category D
      • feed 3
      • feed 4

Here I think querying the api would *not* return category C.

I first noticed the missing category on the Android client but tracked it down to the api by making some direct calls.

Michael

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

Re: API problem with nested categories

Postby fox » 24 Mar 2013, 14:47

You're right. Thanks for noticing this.

https://github.com/gothfox/Tiny-Tiny-RS ... 622b5e7feb

meinfuchs
Bear Rating Trainee
Bear Rating Trainee
Posts: 22
Joined: 22 Mar 2013, 13:58

Re: API problem with nested categories

Postby meinfuchs » 24 Mar 2013, 20:29

Thanks for the quick fix - I just patched my installation and it looks fine!

Vilbrekin
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 28 Mar 2013, 02:59

Re: API problem with nested categories

Postby Vilbrekin » 28 Mar 2013, 03:16

Hello. I'm interested as well in tt-rss and it's API. However I think it's still missing parent's category id to handle properly nested categories.

Indeed in my example, I have:

Code: Select all

root -> Inner1 -> Inner2 -> Inner3 -> feed1
               -> Inner2bis
               -> Inner2ter -> feed2


With your latest change, I'm able to get all of them. However I'm unable to rebuild this tree, as we can't know which one is the parent of the other. Moreover, categories are not listed if there's no feed as leaf (inner2bis is not listed in my case):

Code: Select all

{"seq":0,"status":0,"content":[{"id":"131","title":"Inner1","unread":0,"order_id":0},{"id":"141","title":"Inner2","unread":0,"order_id":0},{"id":"151","title":"Inner3","unread":0,"order_id":0},{"id":"171","title":"inner2ter","unread":0,"order_id":2},{"id":-2,"title":"Labels","unread":"0"},{"id":-1,"title":"Special","unread":56},{"id":0,"title":"Uncategorized","unread":55}]}


I personnally think categories listing should not depend on the inside feeds, as it's up to the client application to include this logic. This would probably break the existing interface.
As a first step, would it be possible to add the parent_category to the output and list all categories (even the ones with no leaf feed)?

Thx,
V

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

Re: API problem with nested categories

Postby fox » 28 Mar 2013, 08:11

>Moreover, categories are not listed if there's no feed as leaf (inner2bis is not listed in my case):

Have you applied the above patch?

Vilbrekin
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 28 Mar 2013, 02:59

Re: API problem with nested categories

Postby Vilbrekin » 28 Mar 2013, 10:55

Yes, I'm using git latest version.

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

Re: API problem with nested categories

Postby fox » 28 Mar 2013, 10:58

Ah, yes, categories which are completely empty, will not be returned. I guess there should be another method to return the whole tree.

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

Re: API problem with nested categories

Postby fox » 28 Mar 2013, 11:05

https://github.com/gothfox/Tiny-Tiny-RS ... b5f5e7d84b

This returns full feed tree in tt-rss data transport format used by feedlists.

Vilbrekin
Bear Rating Trainee
Bear Rating Trainee
Posts: 3
Joined: 28 Mar 2013, 02:59

Re: API problem with nested categories

Postby Vilbrekin » 28 Mar 2013, 15:16

Thanks! It should do the trick.
Just few remarks:
- "unread" count is 0 for all non-special feeds. Is it expected?
- Fully empty categories (without any feed, such as inner2bis in my previous example) are not part of the tree. It makes sense however as the new method is called getFeedTree.
- Shouldn't this deserve a bump of the API version?

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

Re: API problem with nested categories

Postby fox » 28 Mar 2013, 15:20

>unread

Ah, right. Unread numbers are placeholder so that tree is generated faster, tt-rss gets those later from counters (I think that is a separate api call).

>- Fully empty categories (without any feed, such as inner2bis in my previous example) are not part of the tree. It makes sense however as the new method is called getFeedTree.

Yeah, those are not returned because it makes no sense to show them in the UI. I dunno, maybe a parameter could be added to both getCategories and getFeedTree to include empty categories.

>- Shouldn't this deserve a bump of the API version?

I already bumped it for 1.7.6, it's 1 bump for release cycle.

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

Re: API problem with nested categories

Postby fox » 28 Mar 2013, 15:28



Return to “Support”

Who is online

Users browsing this forum: No registered users and 11 guests