Installation¶
Requirements¶
- Python 3.10 or later
- Wagtail 6.0 or later
Install the package¶
Dependencies¶
The following packages are installed automatically:
| Package | Purpose |
|---|---|
django-ninja |
API framework (Pydantic + OpenAPI) |
markdown |
Markdown to HTML conversion |
markdownify |
HTML to Markdown conversion |
qrcode |
QR code generation for mobile app connect |
Configure Django¶
Add the app to INSTALLED_APPS:
Run migrations to create the API token table:
Add the URL routes¶
Include the API URLs in your project's URL configuration:
urls.py
from django.urls import include, path
urlpatterns = [
path("api/write/v1/", include("wagtail_write_api.urls")),
# ... your other URL patterns ...
]
Create an API token¶
Generate a token for a user:
This prints a token you can use in the Authorization header:
Verify it works¶
Start the dev server and check the interactive docs:
Open http://localhost:8000/api/write/v1/docs in your browser.
Test with curl: