Skip to content

Commit ce63d5d

Browse files
committed
docs: enhance API documentation with structured sections and tips
- Added front matter to CLI and API usage documentation for better organization. - Introduced tips and info boxes to highlight important information and best practices. - Updated sections with icons for improved visual clarity and navigation. - Enhanced the OIDC provider setup guide with quick start instructions and detailed configuration tips.
1 parent bcaacca commit ce63d5d

File tree

4 files changed

+143
-40
lines changed

4 files changed

+143
-40
lines changed

api/docs/public/cli.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
---
2+
title: CLI Reference
3+
description: Complete reference for all Unraid API CLI commands
4+
sidebar_position: 4
5+
---
6+
17
# CLI Commands
28

9+
:::info[Command Structure]
10+
All commands follow the pattern: `unraid-api <command> [options]`
11+
:::
12+
13+
## 🚀 Service Management
14+
315
### Start
416

517
```bash
@@ -39,7 +51,7 @@ View the API logs.
3951

4052
- `-l, --lines`: Optional. Number of lines to tail (default: 100)
4153

42-
## Configuration Commands
54+
## ⚙️ Configuration Commands
4355

4456
### Config
4557

api/docs/public/how-to-use-the-api.md

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1+
---
2+
title: Using the Unraid API
3+
description: Learn how to interact with your Unraid server through the GraphQL API
4+
sidebar_position: 2
5+
---
6+
17
# Using the Unraid API
28

9+
:::tip[Quick Start]
10+
The Unraid API provides a powerful GraphQL interface for managing your server. This guide covers authentication, common queries, and best practices.
11+
:::
12+
313
The Unraid API provides a GraphQL interface that allows you to interact with your Unraid server. This guide will help you get started with exploring and using the API.
414

5-
## Enabling the GraphQL Sandbox
15+
## 🎮 Enabling the GraphQL Sandbox
616

717
### Web GUI Method (Recommended)
818

19+
:::info[Preferred Method]
20+
Using the Web GUI is the easiest way to enable the GraphQL sandbox.
21+
:::
22+
923
1. Navigate to **Settings****Management Access****Developer Options**
1024
2. Enable the **GraphQL Sandbox** toggle
1125
3. Access the GraphQL playground by navigating to:
@@ -28,17 +42,22 @@ Or use the interactive mode:
2842
unraid-api developer
2943
```
3044

31-
## Authentication
45+
## 🔑 Authentication
3246

33-
Most queries and mutations require authentication. You can authenticate using either:
47+
:::warning[Required for Most Operations]
48+
Most queries and mutations require authentication. Always include appropriate credentials in your requests.
49+
:::
3450

35-
1. API Keys
36-
2. Cookies (default method when signed into the WebGUI)
37-
3. SSO/OIDC (when configured)
51+
You can authenticate using:
52+
53+
1. **API Keys** - For programmatic access
54+
2. **Cookies** - Automatic when signed into the WebGUI
55+
3. **SSO/OIDC** - When configured with external providers
3856

3957
### Managing API Keys
4058

41-
#### Web GUI Method (Recommended)
59+
<tabs>
60+
<tabItem value="gui" label="Web GUI (Recommended)" default>
4261

4362
Navigate to **Settings****Management Access****API Keys** in your Unraid web interface to:
4463

@@ -47,7 +66,8 @@ Navigate to **Settings** → **Management Access** → **API Keys** in your Unra
4766
- Manage permissions and roles
4867
- Revoke or regenerate keys
4968

50-
#### CLI Method
69+
</tabItem>
70+
<tabItem value="cli" label="CLI Method">
5171

5272
You can also use the CLI to create an API key:
5373

@@ -62,6 +82,9 @@ Follow the prompts to set:
6282
- Roles
6383
- Permissions
6484

85+
</tabItem>
86+
</tabs>
87+
6588
### Using API Keys
6689

6790
The generated API key should be included in your GraphQL requests as a header:
@@ -72,7 +95,7 @@ The generated API key should be included in your GraphQL requests as a header:
7295
}
7396
```
7497

75-
## Available Schemas
98+
## 📊 Available Schemas
7699

77100
The API provides access to various aspects of your Unraid server:
78101

@@ -101,9 +124,9 @@ The API provides access to various aspects of your Unraid server:
101124
- Handle SSO configuration
102125
- Manage allowed origins
103126

104-
### Example Queries
127+
### 💻 Example Queries
105128

106-
1. Check System Status:
129+
#### Check System Status
107130

108131
```graphql
109132
query {
@@ -124,7 +147,7 @@ query {
124147
}
125148
```
126149

127-
2. Monitor Array Status:
150+
#### Monitor Array Status
128151

129152
```graphql
130153
query {
@@ -147,7 +170,7 @@ query {
147170
}
148171
```
149172

150-
3. List Docker Containers:
173+
#### List Docker Containers
151174

152175
```graphql
153176
query {
@@ -161,7 +184,7 @@ query {
161184
}
162185
```
163186

164-
## Schema Types
187+
## 🏗️ Schema Types
165188

166189
The API includes several core types:
167190

@@ -188,19 +211,23 @@ Available roles:
188211
- `connect`: Remote access features
189212
- `guest`: Limited read access
190213

191-
## Best Practices
214+
## Best Practices
192215

216+
:::tip[Pro Tips]
193217
1. Use the Apollo Sandbox to explore the schema and test queries
194218
2. Start with small queries and gradually add fields as needed
195219
3. Monitor your query complexity to maintain performance
196220
4. Use appropriate roles and permissions for your API keys
197221
5. Keep your API keys secure and rotate them periodically
222+
:::
198223

199-
## Rate Limiting
224+
## ⏱️ Rate Limiting
200225

226+
:::caution[Rate Limits]
201227
The API implements rate limiting to prevent abuse. Ensure your applications handle rate limit responses appropriately.
228+
:::
202229

203-
## Error Handling
230+
## 🚨 Error Handling
204231

205232
The API returns standard GraphQL errors in the following format:
206233

@@ -216,11 +243,13 @@ The API returns standard GraphQL errors in the following format:
216243
}
217244
```
218245

219-
## Additional Resources
246+
## 📚 Additional Resources
220247

248+
:::info[Learn More]
221249
- Use the Apollo Sandbox's schema explorer to browse all available types and fields
222250
- Check the documentation tab in Apollo Sandbox for detailed field descriptions
223251
- Monitor the API's health using `unraid-api status`
224252
- Generate reports using `unraid-api report` for troubleshooting
225253

226-
For more information about specific commands and configuration options, refer to the CLI documentation or run `unraid-api --help`.
254+
For more information about specific commands and configuration options, refer to the [CLI documentation](/cli) or run `unraid-api --help`.
255+
:::

api/docs/public/index.md

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
# Unraid API
1+
---
2+
title: Welcome to Unraid API
3+
description: The official GraphQL API for Unraid Server management and automation
4+
sidebar_position: 1
5+
---
6+
7+
# Welcome to Unraid API
8+
9+
:::tip[What's New]
10+
Native integration in Unraid v7.2+ brings the API directly into the OS - no plugin needed!
11+
:::
212

313
The Unraid API provides a GraphQL interface for programmatic interaction with your Unraid server. It enables automation, monitoring, and integration capabilities.
414

5-
## Availability
15+
## 📦 Availability
616

7-
### Native Integration (Unraid v7.2-beta.1+)
17+
### Native Integration (Unraid v7.2-beta.1+)
818

919
Starting with Unraid v7.2-beta.1, the API is integrated directly into the Unraid operating system:
1020

@@ -13,7 +23,7 @@ Starting with Unraid v7.2-beta.1, the API is integrated directly into the Unraid
1323
- Deep system integration
1424
- Access through **Settings****Management Access****API**
1525

16-
### Plugin Installation (Earlier Versions)
26+
### 🔌 Plugin Installation (Earlier Versions)
1727

1828
For Unraid versions prior to v7.2:
1929

@@ -25,15 +35,27 @@ For Unraid versions prior to v7.2:
2535
You can install the Unraid Connect plugin on any version to access pre-release versions of the API and get early access to new features before they're included in Unraid OS releases.
2636
:::
2737

28-
## Documentation Sections
38+
## 📚 Documentation Sections
2939

30-
- [CLI Commands](./cli.md) - Reference for all available command-line interface commands
31-
- [Using the Unraid API](./how-to-use-the-api.md) - Comprehensive guide on using the GraphQL API
32-
- [OIDC Provider Setup](./oidc-provider-setup.md) - OIDC SSO provider configuration examples
33-
- [Upcoming Features](./upcoming-features.md) - Roadmap of planned features and improvements
40+
<cards>
41+
<card title="CLI Commands" icon="terminal" href="./cli">
42+
Complete reference for all CLI commands
43+
</card>
44+
<card title="Using the API" icon="code" href="./how-to-use-the-api">
45+
Learn how to interact with the GraphQL API
46+
</card>
47+
<card title="OIDC Setup" icon="shield" href="./oidc-provider-setup">
48+
Configure SSO authentication providers
49+
</card>
50+
<card title="Upcoming Features" icon="rocket" href="./upcoming-features">
51+
See what's coming next
52+
</card>
53+
</cards>
3454

35-
## Key Features
3655

56+
## 🌟 Key Features
57+
58+
:::info[Core Capabilities]
3759
The API provides:
3860

3961
- **GraphQL Interface**: Modern, flexible API with strong typing
@@ -42,5 +64,27 @@ The API provides:
4264
- **Developer Tools**: Built-in GraphQL sandbox configurable via web interface or CLI
4365
- **Role-Based Access**: Granular permission control
4466
- **Web Management**: Manage API keys and settings through the web interface
67+
:::
68+
69+
## 🚀 Get Started
70+
71+
<tabs>
72+
<tabItem value="v72" label="Unraid v7.2+" default>
73+
74+
1. Access the API settings at **Settings****Management Access****API**
75+
2. Enable the GraphQL Sandbox for development
76+
3. Create your first API key
77+
4. Start making GraphQL queries!
78+
79+
</tabItem>
80+
<tabItem value="older" label="Earlier Versions">
81+
82+
1. Install the Unraid Connect plugin from Apps
83+
2. Configure the plugin settings
84+
3. Enable the GraphQL Sandbox
85+
4. Start exploring the API!
86+
87+
</tabItem>
88+
</tabs>
4589

46-
For detailed usage instructions, see [CLI Commands](./cli.md).
90+
For detailed usage instructions, see the [CLI Commands](./cli) reference.

api/docs/public/oidc-provider-setup.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ sidebar_position: 3
66

77
# OIDC Provider Setup
88

9+
:::info[What is OIDC?]
10+
OpenID Connect (OIDC) is an authentication protocol that allows users to sign in using their existing accounts from providers like Google, Microsoft, or your corporate identity provider. It enables Single Sign-On (SSO) for seamless and secure authentication.
11+
:::
12+
913
This guide walks you through configuring OIDC (OpenID Connect) providers for SSO authentication in the Unraid API using the web interface.
1014

11-
## Accessing OIDC Settings
15+
## 🚀 Quick Start
16+
17+
<details open>
18+
<summary><strong>Getting to OIDC Settings</strong></summary>
1219

1320
1. Navigate to your Unraid server's web interface
1421
2. Go to **Settings****Management Access****API****OIDC**
1522
3. You'll see tabs for different providers - click the **+** button to add a new provider
1623

24+
</details>
25+
1726
### OIDC Providers Interface Overview
1827

1928
![Login Page with SSO Options](./images/sso-with-options.png)
@@ -191,13 +200,17 @@ When "advanced" mode is selected, you'll see:
191200

192201
### Required Redirect URI
193202

194-
All providers must be configured with this redirect URI:
203+
:::caution[Important Configuration]
204+
All providers must be configured with this exact redirect URI format:
205+
:::
195206

196-
```
207+
```bash
197208
http://YOUR_UNRAID_IP/graphql/api/auth/oidc/callback
198209
```
199210

200-
Replace `YOUR_UNRAID_IP` with your actual server IP address.
211+
:::tip
212+
Replace `YOUR_UNRAID_IP` with your actual server IP address (e.g., `192.168.1.100` or `tower.local`).
213+
:::
201214

202215
### Issuer URL Format
203216

@@ -214,7 +227,7 @@ The **Issuer URL** field accepts both formats, but **base URL is strongly recomm
214227
- Keycloak: `https://keycloak.example.com/realms/YOUR_REALM`
215228
- Authelia: `https://auth.yourdomain.com`
216229

217-
## Testing Your Configuration
230+
## Testing Your Configuration
218231

219232
![Login Page with SSO Buttons](./images/sso-with-options.png)
220233
*Unraid login page displaying both traditional username/password authentication and SSO options with customized provider buttons*
@@ -225,7 +238,7 @@ The **Issuer URL** field accepts both formats, but **base URL is strongly recomm
225238
4. Your configured provider button should appear
226239
5. Click to test the login flow
227240

228-
## Troubleshooting
241+
## 🔧 Troubleshooting
229242

230243
### Common Issues
231244

@@ -270,21 +283,21 @@ LOG_LEVEL=debug unraid-api start --debug
270283
- Authorization rule evaluation
271284
- Token validation errors
272285

273-
## Security Best Practices
286+
## 🔐 Security Best Practices
274287

275288
1. **Use Simple Mode for authorization** - Prevents overly accepting configurations and reduces misconfiguration risks
276289
2. **Be specific with authorization** - Don't use overly broad rules
277290
3. **Rotate secrets regularly** - Update client secrets periodically
278291
4. **Test thoroughly** - Verify only intended users can access
279292

280-
## Need Help?
293+
## 💡 Need Help?
281294

282295
- Check provider's OIDC documentation
283296
- Review Unraid API logs for detailed error messages
284297
- Ensure your provider supports standard OIDC discovery
285298
- Verify network connectivity between Unraid and provider
286299

287-
## Provider-Specific Setup
300+
## 🏢 Provider-Specific Setup
288301

289302
### Unraid.net Provider
290303

@@ -304,6 +317,9 @@ Configure authorization rules using Simple Mode (allowed email domains/addresses
304317

305318
### Google
306319

320+
<details>
321+
<summary><strong>📋 Setup Steps</strong></summary>
322+
307323
Set up OAuth 2.0 credentials in [Google Cloud Console](https://console.cloud.google.com/):
308324

309325
1. Go to **APIs & Services****Credentials**
@@ -312,6 +328,8 @@ Set up OAuth 2.0 credentials in [Google Cloud Console](https://console.cloud.goo
312328
4. Add your redirect URI to **Authorized redirect URIs**
313329
5. Configure the OAuth consent screen if prompted
314330

331+
</details>
332+
315333
**Configuration:**
316334

317335
- **Issuer URL**: `https://accounts.google.com`

0 commit comments

Comments
 (0)