This directory contains the OpenAPI specification for the Riffle API.
The API is documented using the OpenAPI 3.0 specification format in the api.yaml
file. This is a standardized, language-agnostic interface description for HTTP APIs that allows both humans and computers to understand the capabilities of a service without direct access to source code or documentation.
You can view the API documentation in several ways:
-
Swagger UI: Import the
api.yaml
file into Swagger Editor to view and interact with the API documentation. -
Redoc: Use Redoc to view a more user-friendly version of the documentation.
-
Postman: Import the
api.yaml
file into Postman to create a collection of API requests that you can use to test the API.
You can use the OpenAPI specification to generate client libraries for various programming languages:
- OpenAPI Generator: Use OpenAPI Generator to generate client libraries for over 40 different languages.
# Install OpenAPI Generator
npm install @openapitools/openapi-generator-cli -g
# Generate a client library (example for Python)
openapi-generator-cli generate -i api.yaml -g python -o ./python-client
- Swagger Codegen: Use Swagger Codegen as an alternative.
The Riffle API provides endpoints for:
- RSS Sources Management: Create, read, update, and delete RSS sources
- RSS Contents Management: Retrieve, update, and delete content items
- Content Fetching: Fetch new content from RSS sources
- Recommendations: Get content recommendations and submit user feedback
- System Information: Check system health and get system information
The import-opml
command can be used to import RSS sources from an OPML file into the database:
riffle import-opml -o path/to/opml/file.opml --db-path ./riffle.db
After importing sources, you can use the API to:
- List the imported sources:
GET /sources
- Check the status of the fetch job:
GET /contents/fetch/{jobId}
- Get content from the imported sources:
GET /contents?sourceId={sourceId}
- Get recommendations based on the imported content:
GET /recommendations
- Import sources from an OPML file using the
import-opml
command - Start the server using the
serve
command - Use the API to manage sources, fetch content, and get recommendations