<commit_before><commit_msg>First part of the API-Docs<commit_after>* API Docs
The API is a simple REST-API with a fairly logical routing structure. But I will
explain all methods in this document.

** Authentication
Authentication in the API is done by having a Session Cookie, to obtain the
cookie, you have to request the regular login-page used by users pick up the
cookie from the response headers. Then you just have to make sure to send it
with all requests.

If you use cURL, you can use a Cookie Jar. Other HTTP does probably provide this
as well.

To login, you could do something like this:
=$ curl -d 'email=my.email%40example.com&password=<PASSWORD>' https://example.com/0bRSS/login=

And if it worked correctly, you will get a 302 to
=https://example.com/0bRSS/login=. Just make sure to catch the cookie which by
default will be named =PHPSESSID=.


** Feed Related Methods
*** List feeds
=GET https://example.com/0bRSS/api/v1/feeds=

Returns a JSON-Array of feeds, including unread-count for each feed.

*** Get single feed
=GET https://example.com/0bRSS/api/v1/feeds/<feed-id>=

Returns a JSON-Object with a single feed, including unread-count as well.

*** Create feed
=POST https://example.com/0bRSS/api/v1/feeds=

Requires a JSON-Body with the following (all required) parameters:
#+BEGIN_SRC json
{
    "name": "<feed-name>",
    "website_uri": "https:\/\/example.org\/",
    "feed_uri": "https:\/\/example.org\/atom.xml",
    "update_interval": 60
}
#+END_SRC

 - name - Name of feed
 - website_uri - Link to the website
 - feed_uri - Link to the feed itself
 - update_interval - How often to update the feed, this is limited by how often
the cron-job is executed.

*** Update feed
=PUT https://example.com/0bRSS/api/v1/feeds/<feed-id>=

Requires a JSON-Body just like the creation call, requires the same parameters.

*** Delete feed
=DELETE https://example.com/0bRSS/api/v1/feeds/<feed-id>=

Delete feed. Will also delete all articles for this feed. Articles and
everything will be deleted from the database, there's no way back.
{'fraction_non_alphanumeric': 0.10385177961969771, 'fraction_numerical': 0.009263773768893223, 'mean_word_length': 3.8857142857142857, 'pattern_counts': {'":': 4, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2900066', 'n_tokens_mistral': 651, 'n_tokens_neox': 626, 'n_words': 263}