Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API #192

Closed
clemera opened this issue Sep 28, 2020 · 7 comments
Closed

REST API #192

clemera opened this issue Sep 28, 2020 · 7 comments

Comments

@clemera
Copy link

clemera commented Sep 28, 2020

Have you thought about providing a REST API returning feed data as JSON? This would help implementing other UI interfaces. I will probably experiment with that and if your are interested provide a PR.

@clemera clemera changed the title Expose REST API REST API Sep 28, 2020
@lemon24
Copy link
Owner

lemon24 commented Sep 29, 2020

I did, but only barely, because it sounds like a lot of work :) If I actually had time to do it, I'd like to have GraphQL API, or a "proper" RESTful API (as described here) that's also OpenAPI-compatible.

For the web app I was a bit more pragmatic and I made a very limited JSON API, but I am reluctant to expose it both because it's very limited, and because I have some "special" requirements (I need it to work both with JSON and with old-style HTML forms).

I am interested, but I currently don't have enough bandwidth to maintain it. If you are willing to do it, we can include it in reader as an extra, or it can live as a separate package.

Once there is a proof of concept, I can add chunked/paginated versions of the methods that return iterables (e.g. get_feeds, get_entries); I held back on this because I didn't really have a use case until now.

Thank you for your interest!

@clemera
Copy link
Author

clemera commented Sep 29, 2020

Thanks for the link! I will start with the simplest thing I can get to work, I'm a beginner with this so don't expect to much. If I have something useable I will post here to let you know and you can think about using it. Being able to pass an offset and a limit as url parameters would be very useful for me I don't know what else, I will have to experiment a bit :)

@lemon24
Copy link
Owner

lemon24 commented Oct 2, 2020

No worries! :) Again, thank you!


Being able to pass an offset and a limit as url parameters would be very useful

The current implementation (not exposed in the public API) uses scrolling window queries instead of limit+offset, for performance reasons.

So, where a limit+offset API would look something like:

get_page_of_things(..., limit=20, offset=0*20) -> [1, 2, ...]
get_page_of_things(..., limit=20, offset=1*20) -> [21, 22, ...]

... the reader API will look like:

get_page_of_things(..., limit=20, next=None) -> ([1, 2, ...], 'next blob')
get_page_of_things(..., limit=20, next='next blob') -> ([21, 22, ...], 'another next blob')

where 'next blob' is an opaque string you pass to the function to get the next page.

This has the downside of not being able to go to the nth page directly, but this functionality can be added later if needed.

@clemera
Copy link
Author

clemera commented Oct 4, 2020

Thanks for your help, I don't think I would have a need to go to the nth page so this should work nice for my purposes. Currently I'm drawn into creating a generic tree UI builder for Emacs after which I plan to use it to implement the feed reader UI so it will take a while until I 'm able to start working on this. I will probably try to model the API similar to the miniflux API.

@lemon24
Copy link
Owner

lemon24 commented Dec 12, 2020

Hi @clemera, pagination is finished now, and should be released in 1.12 in the following days. You can find a short description of how it works here: https://reader.readthedocs.io/en/latest/guide.html#pagination

@clemera
Copy link
Author

clemera commented Dec 12, 2020

Thanks for the notification! It currently busy with other projects but I'm still interested in this!

@lemon24
Copy link
Owner

lemon24 commented Oct 12, 2021

I continue to not have enough bandwidth to implement/maintain a REST API, so I'm closing this for now.

If anyone wants to take on this work, or is willing to pay for it (I can offer commercial support), please re-open the issue. Thank you!

@lemon24 lemon24 closed this as completed Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants