feat: add API endpoint to update indexers (mam_id). Closes #122

This commit is contained in:
Markbeep
2025-08-22 15:01:53 +02:00
parent c8279f0847
commit 9b2cda30c0
10 changed files with 228 additions and 71 deletions
+14 -26
View File
@@ -2,38 +2,26 @@
title: API
description: How to use the AudioBookRequest API
---
## Overview
AudioBookRequest provides a RESTful API for managing users and audiobook requests. The API uses Bearer token authentication with API keys that can be generated through the web interface.
AudioBookRequest provides a RESTful API for a select few endpoints.
The API uses Bearer token authentication with API keys that can be generated
through the web interface.
## How to Create an API Key
Follow these steps to create an API key for accessing the AudioBookRequest API:
### Step 1: Access the Web Interface
1. Open your web browser and navigate to your AudioBookRequest instance
2. Log in with your username and password
### Step 2: Navigate to Account Settings
1. Once logged in, click on the **Settings** menu
2. Select **Account** from the settings options
### Step 3: Create a New API Key
1. In the Account settings page, look for the **API Keys** section
2. Click on **Create New API Key** or similar button
3. Enter a descriptive name for your API key (e.g., "Mobile App", "Automation Script", "Home Assistant Integration")
4. Click **Generate** or **Create**
2. Enter a unique name for your API key
3. Click on **Create API Key**
4. **Important**: The API key will only be displayed once for security reasons
5. Copy the generated API key immediately and store it in a secure location
6. If you lose the key, you'll need to generate a new one
### Step 4: Copy and Store Your API Key
1. **Important**: The API key will only be displayed once for security reasons
2. Copy the generated API key immediately and store it in a secure location
3. If you lose the key, you'll need to generate a new one
### Step 5: Use Your API Key
### Use Your API Key
Include your API key in the Authorization header of your API requests:
@@ -42,14 +30,14 @@ Authorization: Bearer <your-api-key>
```
**Example using cURL:**
```bash
curl -H "Authorization: Bearer your-api-key-here" \
http://localhost:8000/api/users/me
curl -H "Authorization: Bearer <your-api-key-here>" https://abr.example.com/api/users/me
```
## API Documentation
For a SwaggerUI documentation with interactive testing capabilities:
1. Set the environment variable `ABR_OPENAPI_ENABLED=true`
1. Set the environment variable `ABR_APP__OPENAPI_ENABLED=true`
2. Head to `<your-domain>/docs`.
@@ -0,0 +1,58 @@
---
title: Indexers
description: Using the API to access/update indexers
---
There are two main endpoints to work with indexers:
- A `PATCH` to update indexer settings.
- A `GET` to get all the available configuration settings for the indexers.
Head to the main [API Docs](./_index.md) to see how you can access the SwaggerUI
and more easily test the endpoints.
## Getting the Indexer Configurations
To figure out what values you need to adjust, `GET` the endpoint
`/api/indexers/configurations`.
This will give you something along the lines of this:
```json
{
"MyAnonamouse": [
{
"name": "mam_session_id",
"description": null,
"default": null,
"required": true,
"type": "str"
},
{
"name": "mam_active",
"description": null,
"default": "True",
"required": false,
"type": "bool"
}
]
}
```
This gives you the full information about what values can be adjusted.
## Updating Indexer Settings
You can update indexer settings by sending a `PATCH` request to
`/api/indexers/{indexer name}`. The name is **case-sensitive**. The body has to
be a JSON object with key-value pairs of the values you want to update.
Here is an example using cURL: as
```bash
curl -X 'PATCH' \
'https://abr.example.com/api/indexers/MyAnonamouse' \
-H 'accept: application/json' \
-H 'Authorization: Bearer MaEqMYAGY3qvXxtje6-YDxcs4damlyRaKzTC8itG2b8' \
-d '{"mam_session_id":"bXDv1tC1d2MVvOypbFy8Q4Q-rz6q-bKwdqaSZzm85Dg"}'
```