Introducing the Wagtail admin API
Over the past year, we have been working on a new internal REST API to power Wagtail's admin interface. Now that the initial version has landed on master, here's a summary of what this new API will bring to Wagtail.
The Admin API makes it possible for Wagtail's client-side code to fetch content in the background and display it without having to reload the page. This brings more possibilities for improving the UI, as well as improving the developer experience for Wagtail's contributors.
Replacing janky page loads with fluid, animated transitions is a recent trend in web development and we hope to introduce some into Wagtail over the next year. This will be made possible by loading content in the background with the API, before rendering it in the browser without reloading the page.
The first UI feature you can expect to see rebuilt on the Admin API is a new explorer widget - see the video below. We hope to convert more actions (such as page locking) and interfaces (revisions, choosers) to the Admin API soon.
We aim to make the Wagtail codebase as approachable to new contributors as possible. There are a few parts of the codebase where we can do better.
Another benefit to using the Admin API in this way is that individual components do not need to be concerned about business rules (custom permission model, multi-tenancy) as these would be implemented in the API.
Why a new API?
Wagtail already has an API (introduced in Wagtail 1.0) that can be optionally enabled, but which is focused on serving content to public browsers; only live, public content is available.
The Admin API gives access to all content that the logged-in user has permission to see. It also gives access to additional metadata, such as page status and updated times.
How is it implemented?
It is based on Wagtail's existing public API and built using the Django REST Framework.