Add API endpoints
This commit is contained in:
parent
28185736a3
commit
05d7da1f59
5 changed files with 347 additions and 5 deletions
|
|
@ -1,5 +1,160 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h2>API Documentation</h2>
|
||||
<p>This is the API documentation.</p>
|
||||
<p>
|
||||
Missing something? <a href="mailto:hello@feedvault.se">Let me know</a>.
|
||||
</p>
|
||||
<h2>Get All Feeds</h2>
|
||||
<p>GET /api/feeds/</p>
|
||||
<h3>Query Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>page</strong> (optional): The page number of feeds to retrieve. Defaults to 1 if not specified.
|
||||
</li>
|
||||
<li>
|
||||
<strong>per_page</strong> (optional): The number of feeds per page. Defaults to 1000 if not specified. The maximum value is 1000.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Headers</h3>
|
||||
<p>
|
||||
The following headers are sent with the response:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>X-Page</strong>: The current page number.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Page-Count</strong>: The total number of pages.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Per-Page</strong>: The number of feeds per page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Total-Count</strong>: The total number of feeds.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-First-Page</strong>: The page number of the first page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Last-Page</strong>: The page number of the last page.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h3>Python example</h3>
|
||||
<pre>
|
||||
import requests
|
||||
|
||||
page_num = 1
|
||||
per_page = 1000
|
||||
|
||||
url = f'https://feedvault.se/api/feeds/?page={page_num}&per_page={per_page}'
|
||||
response = requests.get(url)
|
||||
print(response.json())
|
||||
</pre>
|
||||
<h3>Example URL</h3>
|
||||
<p>
|
||||
<a href="https://feedvault.se/api/feeds/?page=1&per_page=1000">https://feedvault.se/api/feeds/?page=1&per_page=1000</a>
|
||||
</p>
|
||||
<hr>
|
||||
<h2>Get All Entries</h2>
|
||||
<p>GET /api/entries/</p>
|
||||
<h3>Query Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>page</strong> (optional): The page number of entries to retrieve. Defaults to 1 if not specified.
|
||||
</li>
|
||||
<li>
|
||||
<strong>per_page</strong> (optional): The number of entries per page. Defaults to 1000 if not specified. The maximum value is 1000.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Headers</h3>
|
||||
<p>
|
||||
The following headers are sent with the response:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>X-Page</strong>: The current page number.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Page-Count</strong>: The total number of pages.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Per-Page</strong>: The number of feeds per page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Total-Count</strong>: The total number of feeds.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-First-Page</strong>: The page number of the first page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Last-Page</strong>: The page number of the last page.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h3>Python example</h3>
|
||||
<pre>
|
||||
import requests
|
||||
|
||||
page_num = 1
|
||||
per_page = 1000
|
||||
|
||||
url = f'https://feedvault.se/api/entries/?page={page_num}&per_page={per_page}'
|
||||
response = requests.get(url)
|
||||
print(response.json())
|
||||
</pre>
|
||||
<h3>Example URL</h3>
|
||||
<p>
|
||||
<a href="https://feedvault.se/api/entries/?page=1&per_page=1000">https://feedvault.se/api/entries/?page=1&per_page=1000</a>
|
||||
</p>
|
||||
<hr>
|
||||
<h2>Get All Entries for a Feed</h2>
|
||||
<p>GET /api/feeds/{feed_id}/entries/</p>
|
||||
<h3>Query Parameters</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>page</strong> (optional): The page number of entries to retrieve. Defaults to 1 if not specified.
|
||||
</li>
|
||||
<li>
|
||||
<strong>per_page</strong> (optional): The number of entries per page. Defaults to 1000 if not specified. The maximum value is 1000.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>Headers</h3>
|
||||
<p>
|
||||
The following headers are sent with the response:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>X-Page</strong>: The current page number.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Page-Count</strong>: The total number of pages.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Per-Page</strong>: The number of feeds per page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Total-Count</strong>: The total number of feeds.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-First-Page</strong>: The page number of the first page.
|
||||
</li>
|
||||
<li>
|
||||
<strong>X-Last-Page</strong>: The page number of the last page.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
<h3>Python example</h3>
|
||||
<pre>
|
||||
import requests
|
||||
|
||||
page_num = 1
|
||||
per_page = 1000
|
||||
feed_id = 1
|
||||
|
||||
url = f'https://feedvault.se/api/feeds/{feed_id}/entries/?page={page_num}&per_page={per_page}'
|
||||
response = requests.get(url)
|
||||
print(response.json())
|
||||
</pre>
|
||||
<h3>Example URL</h3>
|
||||
<p>
|
||||
<a href="https://feedvault.se/api/feeds/1/entries/?page=1&per_page=1000">https://feedvault.se/api/feeds/1/entries/?page=1&per_page=1000</a>
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
{% endif %}
|
||||
<style>
|
||||
html {
|
||||
max-width: 70ch;
|
||||
max-width: 88ch;
|
||||
padding: calc(1vmin + 0.5rem);
|
||||
margin-inline: auto;
|
||||
font-size: clamp(1em, 0.909em + 0.45vmin, 1.25em);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
{% for entry in entries %}
|
||||
<li>
|
||||
<a href="{{ entry.link }}">{{ entry.title }}</a>
|
||||
<p>{{ entry.summary }}</p>
|
||||
<p>{{ entry.summary|safe }}</p>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue