A RESTful API service that manages RSS feeds, allowing you to create, retrieve, and filter content in both JSON and XML formats.
- 📋 Get feeds in both JSON and XML formats
- 🆕 Create new feeds via simple POST requests
- 🔍 Filter feeds with powerful search queries
- 📊 Data persistence via JSON file storage
- ⚙️ Configurable via environment variables
- 🖼️ Full image support for feeds and entries
- 🧹 Automatic cleanup of outdated entries
- 🐳 Easy deployment with Docker
The API:
- Stores feed data in a structured JSON file
- Provides RESTful endpoints for CRUD operations
- Supports both JSON and XML output formats
- Automatically cleans up entries older than configured days
- Limits entries per feed to maintain performance
- Provides search functionality with multiple filter options
- Python 3.8+ (for local installation)
- Docker (for Docker installation)
-
Clone this repository:
git clone https://github.com/daquino94/rss-rest-api.git cd rss-feed-api -
Install required dependencies:
pip install -r requirements.txt
-
Run the application:
python rss-rest-api.py
-
Clone this repository:
git clone https://github.com/daquino94/rss-rest-api.git cd rss-feed-api -
Build and run with Docker:
docker build -t rss-feed-api . docker run -d \ --name rss-feed-api \ -p 5000:5000 \ -e RSS_STORAGE_FILE="/data/feeds.json" \ -e HISTORY_DAYS=30 \ -e GENERAL_FEED_TITLE="All Feeds" \ -v $(pwd)/data:/data \ rss-feed-api
-
Create a directory for your data:
mkdir -p rss-feed-api/data cd rss-feed-api -
Update as your prefer a docker-compose.yaml file:
services: rss-feed-api: image: asterix94/rss-rest-api ports: - "5000:5000" environment: - RSS_STORAGE_FILE=/data/feeds.json - HISTORY_DAYS=30 - MAX_ENTRIES_PER_FEED=100 - GENERAL_FEED_TITLE="All Feeds" - DEBUG=False volumes: - ./data:/data restart: unless-stopped
-
Run the container:
docker-compose up -d
Or manually:
docker run -d \ --name rss-feed-api \ -p 5000:5000 \ -e RSS_STORAGE_FILE="/data/feeds.json" \ -e GENERAL_FEED_TITLE="All Feeds" \ -e HISTORY_DAYS=30 \ -v $(pwd)/data:/data \ asterix94/rss-rest-api
The API can be configured using environment variables:
| Environment Variable | Description | Default |
|---|---|---|
RSS_STORAGE_FILE |
Path to the storage file | feeds.json |
HISTORY_DAYS |
Number of days to keep in history | 30 |
MAX_ENTRIES_PER_FEED |
Maximum number of entries per feed | 100 |
GENERAL_FEED_TITLE |
title for feed (global) | All Feeds |
PORT |
Port to expose the API | 5000 |
DEBUG |
Debug mode (true/false) | False |
The complete OpenAPI documentation is available at /docs when the service is running. The OpenAPI specification files are located in the openapi folder of the repository.
GET /feeds
GET /feeds/{feed_id}
GET /feeds/xml
GET /feeds/{feed_id}/xml
POST /feeds
POST /feeds/{feed_id}/entries
GET /feeds/search
DELETE /feeds/{feed_id}
GET /status
curl -X POST http://localhost:5000/feeds \
-H "Content-Type: application/json" \
-d '{
"title": "Tech Blog",
"link": "https://tech-blog.com",
"description": "Latest tech news",
"language": "en-US",
"imageUrl": "https://tech-blog.com/logo.jpg",
"entries": [
{
"title": "Artificial Intelligence in 2025",
"link": "https://tech-blog.com/ai-2025",
"description": "How AI is changing the world",
"pubDate": "Mon, 13 May 2025 10:00:00 GMT",
"imageUrl": "https://tech-blog.com/images/ai.jpg"
}
]
}'curl -X POST http://localhost:5000/feeds/1234-5678/entries \
-H "Content-Type: application/json" \
-d '{
"title": "Web 3.0: The Next Evolution",
"link": "https://tech-blog.com/web3",
"description": "What to expect from Web 3.0",
"pubDate": "Tue, 13 May 2025 08:15:00 GMT",
"imageUrl": "https://tech-blog.com/images/web3.jpg"
}'# Get articles with "intelligence" in the title in JSON format
curl "http://localhost:5000/feeds/search?title=intelligence&format=json"
# Get articles published between two dates in XML format
curl "http://localhost:5000/feeds/search?from_date=2025-05-01&to_date=2025-05-15&format=xml"When using Docker, the API stores data in the mounted /data directory:
feeds.json: Contains all feed data and entries
Make sure to mount this directory as a volume to ensure data persistence between container restarts.
rss-rest-api.py: Flask application with API endpointsmodels/: Data models for feeds and entriesservices/: Business logic for feed managementopenapi/: OpenAPI/Swagger specification filesDockerfile: Configuration for building the Docker imagedocker-compose.yml: Configuration for starting with Docker Composerequirements.txt: Python dependencies
A feed consists of:
feedId: Unique identifier for the feedtitle: Feed titlelink: Feed URLdescription: Feed descriptionlanguage: Feed language (default: en-US)imageUrl: URL of the image associated with the feed (optional)entries: List of feed entries
A feed entry consists of:
title: Entry titlelink: Entry URLdescription: Entry descriptionpubDate: Publication date (RFC822 format)guid: Unique identifier for the entry (automatically generated if not provided)imageUrl: URL of the image associated with the entry (optional)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
