### Initial Metron Setup for Fresh Installs
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Execute these commands on a fresh Metron installation before starting Nginx to apply database migrations and collect static files.
```bash
podman exec metron-web python manage.py migrate
```
```bash
podman exec metron-web python manage.py collectstatic --no-input
```
--------------------------------
### Start Metron Services
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Starts the required systemd user services in the correct order.
```bash
systemctl --user start metron-redis
systemctl --user start metron-web
# Start Anubis (depends on metron-web)
systemctl --user start metron-anubis
```
--------------------------------
### Install and enable fail2ban
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Installs fail2ban and enables the service to monitor logs.
```bash
sudo dnf install -y fail2ban
sudo systemctl enable --now fail2ban
```
--------------------------------
### Install awscli for backups
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Installs the AWS CLI tool to facilitate S3-compatible backups to DigitalOcean Spaces.
```bash
pip3 install awscli
```
--------------------------------
### Scrobble Response Examples
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Example responses for new collection item creation and updating existing items.
```json
{
"id": 789,
"issue": {
"id": 12345,
"series_name": "Amazing Spider-Man",
"number": "300"
},
"is_read": true,
"date_read": "2026-01-08T14:30:00Z",
"read_dates": [
"2026-01-08T14:30:00Z"
],
"read_count": 1,
"rating": 4,
"created": true,
"modified": "2026-01-08T14:30:00Z"
}
```
```json
{
"id": 456,
"issue": {
"id": 12345,
"series_name": "Amazing Spider-Man",
"number": "300"
},
"is_read": true,
"date_read": "2026-01-08T14:30:00Z",
"read_dates": [
"2026-01-08T14:30:00Z",
"2025-12-15T10:00:00Z",
"2025-11-01T08:30:00Z"
],
"read_count": 3,
"rating": 4,
"created": false,
"modified": "2026-01-08T14:30:00Z"
}
```
--------------------------------
### Start Metron Nginx Service
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Starts the Metron Nginx service, which depends on metron-anubis. Ensure this is run after any necessary initial setup.
```bash
systemctl --user start metron-nginx
```
--------------------------------
### Install Certbot on CentOS
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Installs Certbot via the EPEL repository.
```bash
sudo dnf install -y epel-release
sudo dnf install -y certbot
```
--------------------------------
### Pagination Navigation
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Examples of navigating through paginated results with and without filters.
```bash
# First page (default)
GET /api/issue/
# Second page
GET /api/issue/?page=2
# With filters
GET /api/issue/?series_name=spider-man&page=3
```
--------------------------------
### Format HTML Links
Source: https://github.com/metron-project/metron/wiki/Flatpage-Template-Quick-Reference
Examples for internal and external hyperlink implementation.
```html
Browse SeriesExternal Link
```
--------------------------------
### Install Quadlet unit files
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Deploy Quadlet files to the user configuration directory and reload systemd.
```bash
mkdir -p ~/.config/containers/systemd
cp ~/metron/.quadlet/* ~/.config/containers/systemd/
systemctl --user daemon-reload
```
```bash
systemctl --user list-unit-files 'metron-*'
```
--------------------------------
### Scrobble API curl Examples
Source: https://github.com/metron-project/metron/blob/master/user_collection/README.md
Examples of using curl to mark issues as read with and without optional parameters.
```bash
# Mark issue #12345 as read right now
curl -X POST https://metron.cloud/api/collection/scrobble/ \
-u "username:password" \
-H "Content-Type: application/json" \
-d '{"issue_id": 12345}'
# Mark as read with specific date and rating
curl -X POST https://metron.cloud/api/collection/scrobble/ \
-u "username:password" \
-H "Content-Type: application/json" \
-d '{
"issue_id": 12345,
"date_read": "2026-01-08T10:00:00Z",
"rating": 5
}'
```
--------------------------------
### Cutover: Start Services on New Droplet
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Start the remaining Metron services on the new droplet after the database has been restored. This includes Redis, web, and Nginx.
```bash
# 5. On the NEW droplet — start remaining services
systemctl --user start metron-redis metron-web metron-nginx
```
--------------------------------
### Get Entire Collection
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve all items in your collection. No specific setup is required beyond authentication.
```bash
GET /api/collection/
```
--------------------------------
### Example success messages for AddIssuesFromSeriesView
Source: https://github.com/metron-project/metron/blob/master/user_collection/TECHNICAL.md
Sample feedback strings returned after bulk adding issues to a collection.
```python
# Example success messages:
"Added 50 issues to your collection! Skipped 5 issues already in your collection."
"Added 100 issues to your collection (marked as read)!"
"All issues from this series are already in your collection."
```
--------------------------------
### Create the deploy user
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Setup a dedicated service account for running containers and ensure systemd user services persist.
```bash
sudo useradd -m metron
sudo loginctl enable-linger metron
sudo usermod -aG systemd-journal metron
```
```bash
sudo su - metron
```
```bash
echo 'export XDG_RUNTIME_DIR=/run/user/$(id -u)' >> /home/metron/.bashrc
```
--------------------------------
### 404 Not Found Error Example
Source: https://github.com/metron-project/metron/blob/master/api/README.md
This error is returned when a requested resource cannot be found. Verify the resource ID is correct.
```json
{
"detail": "Not found."
}
```
--------------------------------
### GET /api/role/
Source: https://context7.com/metron-project/metron/llms.txt
Retrieves a list of available creator roles.
```APIDOC
## GET /api/role/
### Description
Returns a list of all available creator roles used in the system.
### Method
GET
### Endpoint
https://metron.cloud/api/role/
### Response
#### Success Response (200)
- **results** (array) - List of role objects containing id and name.
```
--------------------------------
### List Series by Year Began
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve series that started in a specific year.
```bash
# Get series from a specific year
GET /api/series/?year_began=2020
```
--------------------------------
### Provision the droplet
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Install necessary packages and configure firewalld to forward traffic from standard HTTP/HTTPS ports to the rootless container ports.
```bash
dnf install -y podman firewalld git
systemctl enable --now firewalld
# Forward external ports 80/443 to the ports the rootless nginx container
# binds (8080/8443). Masquerade is required for local port forwarding.
firewall-cmd --permanent --add-forward-port=port=80:proto=tcp:toport=8080
firewall-cmd --permanent --add-forward-port=port=443:proto=tcp:toport=8443
firewall-cmd --permanent --add-masquerade
firewall-cmd --reload
```
--------------------------------
### Reading List API Usage Examples
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Common API requests for listing, filtering, and retrieving reading list data.
```bash
# List all accessible reading lists
GET /api/reading_list/
# Find public reading lists
GET /api/reading_list/?is_private=false
# Find lists by username
GET /api/reading_list/?username=johndoe
# Find lists from Comic Book Reading Orders
GET /api/reading_list/?attribution_source=CBRO
# Find reading lists by publisher
GET /api/reading_list/?publisher=marvel
# Find event reading lists
GET /api/reading_list/?list_type=EVENT
# Find highly-rated reading lists (4+ stars)
GET /api/reading_list/?average_rating__gte=4
# Find quality public reading lists
GET /api/reading_list/?is_private=false&average_rating__gte=4.5
# Get reading list details
GET /api/reading_list/1/
# Get items in a reading list
GET /api/reading_list/1/items/
```
--------------------------------
### Query Arc Endpoints
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Examples of filtering arcs by name and retrieving issues associated with a specific arc.
```bash
# Get all arcs with "secret" in the name
GET /api/arc/?name=secret
# Get issues in an arc
GET /api/arc/123/issue_list/
```
--------------------------------
### Team List Response Structure
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Example JSON structure for a list of teams. Includes basic team information.
```json
{
"id": 1,
"name": "Avengers",
"slug": "avengers",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Wiki Image Markdown Syntax
Source: https://github.com/metron-project/metron/blob/master/templates/wiki/plugins/images/sidebar.html
Example of the Markdown syntax used to embed images within wiki articles.
```markdown
[image:id align:right size:orig]
caption indented by 4 spaces
```
--------------------------------
### Creator List Response Structure
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Example JSON structure for a list of creators. Includes basic identification and modification timestamp.
```json
{
"id": 1,
"name": "Stan Lee",
"slug": "stan-lee",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Configure the environment file
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Set up the environment configuration file and generate a signing key.
```bash
mkdir -p ~/.config/containers
cp ~/metron/metron.env.example ~/.config/containers/metron.env
chmod 600 ~/.config/containers/metron.env
vi ~/.config/containers/metron.env # fill in all values
```
```bash
openssl rand -hex 32
```
--------------------------------
### Conditional Request Example using Python Requests
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Shows how to implement conditional requests in Python using the `requests` library. It first fetches a resource to get the `Last-Modified` header and then uses it in a subsequent request.
```python
import requests
session = requests.Session()
session.auth = ("username", "password")
# First request
resp = session.get("https://metron.cloud/api/issue/12345/")
last_modified = resp.headers["Last-Modified"]
# Subsequent request with conditional header
resp = session.get(
"https://metron.cloud/api/issue/12345/",
headers={"If-Modified-Since": last_modified},
)
if resp.status_code == 304:
print("Resource has not changed, use cached data")
else:
data = resp.json()
```
--------------------------------
### Enable and verify automated backups
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Commands to initialize the backup directory, enable the timer, and verify the backup status.
```bash
mkdir -p ~/backups
systemctl --user daemon-reload
systemctl --user enable --now metron-backup.timer
# Verify it is scheduled
systemctl --user list-timers metron-backup.timer
```
--------------------------------
### Create admin users and add SSH keys
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Commands to create a new admin user, set a temporary password, and configure SSH key-based authentication.
```bash
# Create the admin account
useradd -m -G wheel
# Set a temporary password — share it with the admin out-of-band and force
# them to change it on first login
passwd
chage -d 0
# Add their SSH public key
mkdir -p /home//.ssh
chmod 700 /home//.ssh
echo "" > /home//.ssh/authorized_keys
chmod 600 /home//.ssh/authorized_keys
chown -R : /home//.ssh
```
```bash
# Once all admins can log in with their keys, disable password auth
sed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
systemctl restart sshd
```
--------------------------------
### Scrobble Response JSON Example
Source: https://github.com/metron-project/metron/blob/master/user_collection/TECHNICAL.md
Example JSON structure for a scrobble response, detailing the format of returned data including issue information and read status.
```json
{
"id": 123,
"issue": {
"id": 456,
"series_name": "Amazing Spider-Man",
"number": "1"
},
"is_read": true,
"date_read": "2026-01-08T14:30:00Z",
"rating": 5,
"created": true,
"modified": "2026-01-08T14:30:00Z"
}
```
--------------------------------
### Execute manual backup
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Runs the backup script directly from the repository.
```bash
# Run the backup script directly
bash ~/metron/scripts/backup.sh
```
--------------------------------
### GET /api/universe/
Source: https://context7.com/metron-project/metron/llms.txt
Endpoints for retrieving universe information.
```APIDOC
## GET /api/universe/
### Description
List all universes or search by designation.
### Method
GET
### Endpoint
https://metron.cloud/api/universe/
### Parameters
#### Query Parameters
- **designation** (string) - Optional - Search by universe designation
### Response
#### Success Response (200)
- **id** (integer) - Universe ID
- **name** (string) - Universe name
- **designation** (string) - Universe designation
- **publisher** (object) - Associated publisher
#### Response Example
{
"id": 1,
"name": "Earth-616",
"slug": "earth-616",
"designation": "616",
"publisher": {"id": 1, "name": "Marvel Comics"},
"desc": "The main Marvel Comics universe...",
"image": "https://metron.cloud/media/universes/earth-616.jpg",
"resource_url": "https://metron.cloud/universe/earth-616/",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### GET /api/imprint/
Source: https://context7.com/metron-project/metron/llms.txt
Endpoints for retrieving imprint information.
```APIDOC
## GET /api/imprint/
### Description
List all imprints or search by name. Imprints are sub-labels of publishers.
### Method
GET
### Endpoint
https://metron.cloud/api/imprint/
### Parameters
#### Query Parameters
- **name** (string) - Optional - Search imprints by name
### Response
#### Success Response (200)
- **id** (integer) - Imprint ID
- **name** (string) - Imprint name
- **publisher** (object) - Parent publisher details
#### Response Example
{
"id": 5,
"name": "Vertigo",
"slug": "vertigo",
"founded": 1993,
"publisher": {"id": 2, "name": "DC Comics"},
"desc": "An imprint focusing on mature readers...",
"image": "https://metron.cloud/media/imprints/vertigo.jpg",
"cv_id": 1111,
"gcd_id": 2222,
"resource_url": "https://metron.cloud/imprint/vertigo/",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Restore database from backup
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Steps to copy a dump file into the container and restore the database using pg_restore.
```bash
# Copy the dump into the container (from local or download from Spaces)
podman cp ~/backups/ metron-postgres:/tmp/metron.dump
# Stop the web service to prevent writes during restore
systemctl --user stop metron-web
# Restore
podman exec metron-postgres pg_restore \
--username {db_username} \
--dbname {db_name} \
--no-owner \
--role {db_username} \
--verbose \
/tmp/metron.dump
# Clean up and restart
podman exec metron-postgres rm /tmp/metron.dump
systemctl --user start metron-web
```
--------------------------------
### Build Metron App Image
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Builds the container image using Podman.
```bash
cd ~/metron
podman build -t localhost/metron:latest .
```
--------------------------------
### GET /api/series_type/
Source: https://context7.com/metron-project/metron/llms.txt
Retrieves a list of available series types.
```APIDOC
## GET /api/series_type/
### Description
Returns a list of all available series types (e.g., Ongoing, Mini-Series).
### Method
GET
### Endpoint
https://metron.cloud/api/series_type/
### Response
#### Success Response (200)
- **results** (array) - List of series type objects containing id and name.
```
--------------------------------
### Test ReadingList Model Constraints and Properties
Source: https://github.com/metron-project/metron/blob/master/reading_lists/TECHNICAL.md
Demonstrates basic model testing using Django's TestCase, including setup and integrity constraint validation.
```python
class ReadingListModelTest(TestCase):
def setUp(self):
self.user = CustomUser.objects.create_user(username="testuser")
self.reading_list = ReadingList.objects.create(
user=self.user,
name="Test List"
)
def test_unique_constraint(self):
"""Test that users cannot create duplicate list names."""
with self.assertRaises(IntegrityError):
ReadingList.objects.create(
user=self.user,
name="Test List"
)
def test_start_year_with_no_issues(self):
"""Test start_year returns None when list is empty."""
self.assertIsNone(self.reading_list.start_year)
```
--------------------------------
### Configure Fail2ban for Metron
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Sets up fail2ban by copying configuration files and restarting the service. Ensure the log directory exists and has correct permissions.
```bash
sudo mkdir -p /var/log/metron-nginx
sudo chown metron:metron /var/log/metron-nginx
```
```bash
sudo sh -c 'cp /home/metron/metron/fail2ban/action.d/* /etc/fail2ban/action.d/'
sudo sh -c 'cp /home/metron/metron/fail2ban/filter.d/* /etc/fail2ban/filter.d/'
sudo sh -c 'cp /home/metron/metron/fail2ban/jail.d/metron.conf /etc/fail2ban/jail.d/'
sudo systemctl restart fail2ban
```
--------------------------------
### GET /api/team/
Source: https://context7.com/metron-project/metron/llms.txt
Endpoints for retrieving team information and associated issues.
```APIDOC
## GET /api/team/
### Description
List all teams, search by name, or retrieve details for a specific team.
### Method
GET
### Endpoint
https://metron.cloud/api/team/
### Parameters
#### Query Parameters
- **name** (string) - Optional - Search teams by name
### Response
#### Success Response (200)
- **id** (integer) - Team ID
- **name** (string) - Team name
- **creators** (array) - List of associated creators
- **universes** (array) - List of associated universes
#### Response Example
{
"id": 10,
"name": "Avengers",
"slug": "avengers",
"desc": "Earth's Mightiest Heroes...",
"image": "https://metron.cloud/media/teams/avengers.jpg",
"creators": [{"id": 789, "name": "Stan Lee", "slug": "stan-lee", "modified": "..."}],
"universes": [{"id": 1, "name": "Earth-616", "slug": "earth-616", "designation": "616", "modified": "..."}],
"cv_id": 3333,
"gcd_id": 4444,
"resource_url": "https://metron.cloud/team/avengers/",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Initialize Issue Management UI
Source: https://github.com/metron-project/metron/blob/master/reading_lists/templates/reading_lists/add_issue_autocomplete.html
Sets up event listeners and initializes the issue tracking state from existing server-side data.
```javascript
document.addEventListener('DOMContentLoaded', function() { const selectedIssuesList = document.getElementById('selected-issues-list'); const selectedIssuesContainer = document.getElementById('selected-issues-container'); const issueOrderField = document.querySelector('[name="issue_order"]'); // Store issue data: id -> label mapping // This will be populated from the autocomplete widget's data const issueData = {}; // Cache for fetched issue labels const issueLabelCache = {}; // Track which issues are existing vs new const existingIssueIds = new Set(); // Pre-load existing issues from the reading list const existingIssues = [ {% for item in existing_items %}{id: '{{ item.issue.pk }}', label: '{{ item.issue|escapejs }}'},{% endfor %} ]; // Populate issueData with existing issues existingIssues.forEach(issue => { issueData[issue.id] = issue.label; issueLabelCache[issue.id] = issue.label; existingIssueIds.add(issue.id); }); // Find the autocomplete container const autocompleteContainer = document.querySelector('.phac_aspc_form_autocomplete'); if (!autocompleteContainer) { console.error('Autocomplete container not found'); return; } // Function to get selected issues from the autocomplete widget function getSelectedIssues() { // The autocomplete widget creates hidden inputs with name="issues" const hiddenInputs = autocompleteContainer.querySelectorAll('input[name="issues"][type="hidden"]'); const issues = []; hiddenInputs.forEach(input => { if (input.value && !input.classList.contains('ac_required_input')) { issues.push(input.value); } }); return issues; } // Function to get issue labels from the autocomplete chips function updateIssueDataFromChips() { // The autocomplete widget shows selected items as chips const chips = autocompleteContainer.querySelectorAll('li.chip'); chips.forEach(chip => { // Get the label from the span element (first span in the chip) const labelSpan = chip.querySelector('span'); if (!labelSpan) return; const label = labelSpan.textContent.trim(); // Get the issue ID from the hx-vals attribute on the anchor tag const anchor = chip.querySelector('a[hx-vals]'); if (anchor) { const hxVals = anchor.getAttribute('hx-vals'); // Parse the JSON-like hx-vals to extract the item ID try { // The hx-vals contains: {"remove": true, "item": "12345"} const match = hxVals.match(/"item"\s*:\s*"(\d+)"/); if (match) { const issueId = match[1]; issueData[issueId] = label; issueLabelCache[issueId] = label; } } catch (e) { console.error('Error parsing hx-vals:', e); } } }); } // Function to update the draggable list function updateSelectedIssuesList() { updateIssueDataFromChips(); const newlySelectedIssues = getSelectedIssues(); // Combine existing issues with newly selected issues const allIssueIds = new Set([...existingIssues.map(i => i.id), ...newlySelectedIssues]); // Always show the container if there are any issues (existing or new) if (allIssueIds.size === 0) { selectedIssuesContainer.style.display = 'none'; selectedIssuesList.innerHTML = ''; issueOrderField.value = ''; return; } // Show the container selectedIssuesContainer.style.display = 'block'; // Get currently displayed issue IDs to preserve order const currentItems = Array.from(selectedIssuesList.querySelectorAll('.draggable-issue')); const currentOrder = currentItems.map(item => item.dataset.issueId); // Determine final order: preserve existing order, append new ones const finalOrder = []; // First, preserve the order of items already in the list currentOrder.forEach(id => { if (allIssueIds.has(id)) { finalOrder.push(id); } }); // Then add any new items that weren't in the current order allIssueIds.forEach(id => { if (!finalOrder.includes(id)) { finalOrder.push(id); } }); // Rebuild the list selectedIssuesList.innerHTML = ''; finalOrder.forEach(issueId => { const issueLabel = issueData[issueId] || `Issue #${issueId}`; const isExisting = existingIssueIds.has(issueId); const div = document.createElement('div'); div.className = `draggable-issue box mb-2 p-3 ${isExisting ? 'is-existing-issue' : 'is-new-issue'}`; div.dataset.issueId = issueId; const badge = isExisting ? 'Current' : 'New'; div.innerHTML = ` ${issueLabel} ${badge} `; selectedIssuesList.appendChild(div); }); // Update hidden field updateIssueOrder(); } // Function to update the hidden issue
```
--------------------------------
### GET /api/publisher/
Source: https://context7.com/metron-project/metron/llms.txt
Endpoints for retrieving publisher information and their associated series.
```APIDOC
## GET /api/publisher/
### Description
List all publishers or search by name. Also supports retrieving specific publisher details and a list of series for a publisher.
### Method
GET
### Endpoint
https://metron.cloud/api/publisher/
### Parameters
#### Query Parameters
- **name** (string) - Optional - Search publishers by name
### Response
#### Success Response (200)
- **id** (integer) - Publisher ID
- **name** (string) - Publisher name
- **slug** (string) - URL slug
- **founded** (integer) - Founding year
- **desc** (string) - Description
- **image** (string) - Image URL
- **cv_id** (integer) - Comic Vine ID
- **gcd_id** (integer) - GCD ID
- **resource_url** (string) - Canonical URL
- **modified** (string) - Last modified timestamp
#### Response Example
{
"id": 1,
"name": "Marvel Comics",
"slug": "marvel-comics",
"founded": 1939,
"desc": "American entertainment company...",
"image": "https://metron.cloud/media/publishers/marvel.jpg",
"cv_id": 31,
"gcd_id": 78,
"resource_url": "https://metron.cloud/publisher/marvel-comics/",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Test and verify backups
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Commands to manually trigger a backup and verify the existence of local and remote files.
```bash
systemctl --user start metron-backup
journalctl _SYSTEMD_USER_UNIT=metron-backup.service -n 20
# Check local copy
ls -lh ~/backups/
# Check Spaces copy (substitute your endpoint and bucket)
AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= \
aws s3 ls s3:///db/ \
--endpoint-url
```
--------------------------------
### GET /api/reading_list/{id}/
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve detailed information about a specific reading list.
```APIDOC
## GET /api/reading_list/{id}/
### Description
Retrieve full details for a specific reading list.
### Method
GET
### Endpoint
/api/reading_list/{id}/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The ID of the reading list
### Response
#### Success Response (200)
- **id** (integer) - Reading list ID
- **name** (string) - List name
- **desc** (string) - Description
- **image** (string) - Cover image URL
- **list_type** (string) - Human-readable list type
- **attribution_source** (string) - Full attribution source name
- **attribution_url** (string) - URL to source
- **average_rating** (float) - Average rating
- **rating_count** (integer) - Total number of ratings
- **items_url** (string) - URL to fetch items
- **resource_url** (string) - Link to web UI
```
--------------------------------
### GET /api/reading_list/
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve a list of accessible reading lists with optional filtering.
```APIDOC
## GET /api/reading_list/
### Description
List accessible reading lists based on provided filters.
### Method
GET
### Endpoint
/api/reading_list/
### Parameters
#### Query Parameters
- **name** (string) - Optional - Reading list name (case-insensitive, partial match)
- **user** (integer) - Optional - User ID (exact match)
- **username** (string) - Optional - Username (case-insensitive, partial match)
- **publisher** (string) - Optional - Publisher name (case-insensitive, partial match)
- **attribution_source** (string) - Optional - Attribution source code (exact match)
- **list_type** (string) - Optional - List type code (exact match)
- **is_private** (boolean) - Optional - Filter by privacy status
- **average_rating__gte** (float) - Optional - Minimum average rating (1.0 to 5.0)
- **modified_gt** (datetime) - Optional - Modified after datetime
### Response Example
[
{
"id": 1,
"name": "Secret Wars (2015)",
"slug": "secret-wars-2015",
"user": {
"id": 5,
"username": "johndoe"
},
"list_type": "Event",
"is_private": false,
"attribution_source": "CBRO",
"average_rating": 4.5,
"rating_count": 12,
"modified": "2025-01-15T10:30:00Z"
}
]
```
--------------------------------
### GET /api/universe/{id}/
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve detailed information for a specific universe by its ID.
```APIDOC
## GET /api/universe/{id}/
### Description
Retrieve full details for a specific universe.
### Method
GET
### Endpoint
/api/universe/{id}/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the universe
### Response
#### Success Response (200)
- **id** (integer) - Universe ID
- **name** (string) - Universe name
- **slug** (string) - URL slug
- **designation** (string) - Universe designation
- **modified** (datetime) - Last modified timestamp
- **publisher** (object) - Publisher object
- **desc** (string) - Description
- **image** (string) - Universe image URL
- **resource_url** (string) - Link to web UI
```
--------------------------------
### GET /api/universe/
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve a list of all comic book universes with optional filtering.
```APIDOC
## GET /api/universe/
### Description
List all universes available in the system. Supports filtering by name, designation, and modification date.
### Method
GET
### Endpoint
/api/universe/
### Parameters
#### Query Parameters
- **name** (string) - Optional - Universe name (case-insensitive, partial match)
- **designation** (string) - Optional - Universe designation (case-insensitive, partial match)
- **modified_gt** (datetime) - Optional - Modified after datetime
### Response
#### Success Response (200)
- **id** (integer) - Universe ID
- **name** (string) - Universe name
- **slug** (string) - URL slug
- **designation** (string) - Universe designation
- **modified** (datetime) - Last modified timestamp
#### Response Example
{
"id": 1,
"name": "Earth-616",
"slug": "earth-616",
"designation": "616",
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### GET /api/series/{id}/issue_list/
Source: https://context7.com/metron-project/metron/llms.txt
Retrieve all issues associated with a specific series.
```APIDOC
## GET /api/series/{id}/issue_list/
### Description
Retrieve a list of all issues belonging to the specified series.
### Method
GET
### Endpoint
https://metron.cloud/api/series/{id}/issue_list/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the series
```
--------------------------------
### Configure database backup timer
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Defines a systemd timer to trigger the database backup daily at 02:00.
```ini
[Unit]
Description=Daily Metron database backup
[Timer]
OnCalendar=*-*-* 02:00:00
RandomizedDelaySec=30m
Persistent=true
[Install]
WantedBy=timers.target
```
--------------------------------
### 401 Unauthorized Error Example
Source: https://github.com/metron-project/metron/blob/master/api/README.md
This error occurs when authentication credentials are not provided. Include them in your request.
```json
{
"detail": "Authentication credentials were not provided."
}
```
--------------------------------
### Reading List Response Structure
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Example JSON response for a reading list object.
```json
{
"id": 1,
"name": "Secret Wars (2015)",
"slug": "secret-wars-2015",
"user": {
"id": 5,
"username": "johndoe"
},
"list_type": "Event",
"is_private": false,
"attribution_source": "CBRO",
"average_rating": 4.5,
"rating_count": 12,
"modified": "2025-01-15T10:30:00Z"
}
```
--------------------------------
### Combine Multiple Filters
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Demonstrates applying multiple query parameters to an issue lookup.
```bash
GET /api/issue/?series_name=spider-man&cover_year=2024&publisher_name=marvel
```
--------------------------------
### Get Reading List Items
Source: https://github.com/metron-project/metron/blob/master/reading_lists/TECHNICAL.md
Retrieves all items within a specific reading list.
```APIDOC
## GET /api/reading_list/{id}/reading_list_item_list/
### Description
Retrieves the list of items for a specific reading list.
### Method
GET
### Endpoint
/api/reading_list/{id}/reading_list_item_list/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the reading list.
### Response
#### Success Response (200)
- **id** (integer) - The unique identifier of the reading list item.
- **issue** (object) - Details of the comic issue.
- **series** (string) - The name of the comic series.
- **number** (string) - The issue number.
- **order** (integer) - The order of the item within the reading list.
- **issue_type** (string) - The type of the issue (e.g., "Prologue", "Core Issue", "Tie-In", "Epilogue").
### Response Example
{
"reading_list_items": [
{
"id": 1,
"issue": {
"series": "Secret Wars",
"number": "1"
},
"order": 1,
"issue_type": "Core Issue"
},
{
"id": 2,
"issue": {
"series": "Amazing Spider-Man",
"number": "1"
},
"order": 2,
"issue_type": "Tie-In"
}
]
}
```
--------------------------------
### Define ReadingListItem Meta options
Source: https://github.com/metron-project/metron/blob/master/reading_lists/TECHNICAL.md
Configures ordering and database indexing for ReadingListItem.
```python
class Meta:
ordering = ["reading_list", "order"]
indexes = [
models.Index(fields=["reading_list", "order"], name="reading_list_order_idx"),
]
```
--------------------------------
### GET /reading-lists (Filtering)
Source: https://github.com/metron-project/metron/blob/master/reading_lists/TECHNICAL.md
API endpoint filter documentation for querying ReadingList objects.
```APIDOC
## GET /reading-lists
### Description
Filter ReadingList objects using various criteria including name, user, and ratings.
### Method
GET
### Parameters
#### Query Parameters
- **name** (string) - Optional - Case-insensitive search on list name
- **user** (number) - Optional - Filter by user ID
- **username** (string) - Optional - Case-insensitive search on username
- **attribution_source** (string) - Optional - Filter by attribution source
- **is_private** (boolean) - Optional - Filter by privacy status
- **modified_gt** (datetime) - Optional - Filter by modification date (greater than)
- **average_rating__gte** (number) - Optional - Filter by minimum average rating (1-5)
```
--------------------------------
### Implement Full-Width Layout
Source: https://github.com/metron-project/metron/wiki/Flatpage-Template-Quick-Reference
Django template for a full-height hero layout.
```django
{% extends "base.html" %}
{% block content %}
{{ flatpage.title }}
{{ flatpage.content|safe }}
{% endblock %}
```
--------------------------------
### GET /api/series/{id}/
Source: https://context7.com/metron-project/metron/llms.txt
Retrieve detailed information for a specific comic book series.
```APIDOC
## GET /api/series/{id}/
### Description
Retrieve full metadata for a specific series, including genres, associated series, and publication history.
### Method
GET
### Endpoint
https://metron.cloud/api/series/{id}/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the series
```
--------------------------------
### Image Alignment and Size Options
Source: https://github.com/metron-project/metron/blob/master/templates/wiki/plugins/images/sidebar.html
Valid configuration values for image alignment and size parameters.
```text
left | right
```
```text
small | medium | large | orig | default
```
--------------------------------
### GET /collection//
Source: https://github.com/metron-project/metron/blob/master/user_collection/TECHNICAL.md
Retrieves the details of a specific collection item, restricted to the item owner.
```APIDOC
## GET /collection//
### Description
Displays the full details of a specific collection item. Access is restricted to the owner of the item.
### Method
GET
### Endpoint
/collection//
### Parameters
#### Path Parameters
- **pk** (integer) - Required - The primary key of the collection item
```
--------------------------------
### Get Collection Statistics
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Retrieve statistical data about your collection. This endpoint provides aggregated information.
```bash
GET /api/collection/stats/
```
--------------------------------
### Import Reading Lists via CLI
Source: https://github.com/metron-project/metron/blob/master/reading_lists/TECHNICAL.md
Execute the management command to import reading lists from a specified JSON file.
```bash
python manage.py import_reading_lists
```
--------------------------------
### Perform a GET request with cURL
Source: https://github.com/metron-project/metron/blob/master/api/README.md
Use cURL to authenticate and retrieve a list of issues from the API.
```bash
# Get a list of issues
curl -X GET https://metron.cloud/api/issue/ \
-u "username:password"
```
--------------------------------
### Configure backup environment variables
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Updates the environment file with the designated backup bucket name.
```bash
vi ~/.config/containers/metron.env
# Set DO_BACKUP_BUCKET_NAME=metron-backups (or your chosen name)
```
--------------------------------
### GET /api/issue/{id}/
Source: https://context7.com/metron-project/metron/llms.txt
Retrieve detailed information for a specific comic book issue by its ID.
```APIDOC
## GET /api/issue/{id}/
### Description
Retrieve full metadata for a specific issue, including credits, characters, variants, and identifiers.
### Method
GET
### Endpoint
https://metron.cloud/api/issue/{id}/
### Parameters
#### Path Parameters
- **id** (integer) - Required - The unique identifier of the issue
```
--------------------------------
### Enable persistent journal logs
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Commands to create the journal directory and restart the journald service for persistent logging.
```bash
sudo mkdir -p /var/log/journal
sudo systemd-tmpfiles --create --prefix /var/log/journal
sudo systemctl restart systemd-journald
```
--------------------------------
### Get Series Details
Source: https://context7.com/metron-project/metron/llms.txt
Retrieve detailed information for a specific series by its ID. Authentication is required.
```bash
curl -X GET "https://metron.cloud/api/series/100/" \
-u "username:password"
```
--------------------------------
### Configure database backup service
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Defines a systemd service unit to execute the database backup script.
```ini
[Unit]
Description=Metron PostgreSQL backup
After=metron-postgres.service
[Service]
Type=oneshot
EnvironmentFile=%h/.config/containers/metron.env
ExecStart=/bin/bash %h/metron/scripts/backup.sh
```
--------------------------------
### Create Credits and Variants
Source: https://context7.com/metron-project/metron/llms.txt
Administrative endpoints for creating credits and variant covers, requiring editor or admin privileges.
```bash
curl -X POST "https://metron.cloud/api/credit/" \
-u "editor:password" \
-H "Content-Type: application/json" \
-d '[
{"issue": 12345, "creator": 789, "role": [1, 2]}
]'
```
```bash
curl -X POST "https://metron.cloud/api/variant/" \
-u "editor:password" \
-F "issue=12345" \
-F "name=Variant Cover" \
-F "sku=MAR190801" \
-F "upc=75960609558200112" \
-F "image=@/path/to/variant.jpg"
```
--------------------------------
### Clone the repository
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Clone the Metron project repository as the service user.
```bash
sudo su - metron
cd ~
git clone https://github.com/Metron-Project/metron.git metron
```
--------------------------------
### Configure django-simple-history cleanup timer
Source: https://github.com/metron-project/metron/blob/master/DEPLOYMENT.md
Defines a systemd timer to trigger the cleanup service every 30 minutes.
```ini
[Unit]
Description=Periodic django-simple-history duplicate cleanup
[Timer]
OnCalendar=*-*-* *:00,30:00
Persistent=true
[Install]
WantedBy=timers.target
```
--------------------------------
### 403 Forbidden Error Example
Source: https://github.com/metron-project/metron/blob/master/api/README.md
This error indicates insufficient permissions for the requested action. Ensure you have the necessary permissions.
```json
{
"detail": "You do not have permission to perform this action."
}
```