OpenAPI Explorer
Part of the Openapi ecosystem · 4 projects
Generates an OpenAPI 3 specification for the HTTP routes your Drupal site exposes, and renders it as browsable documentation with an interactive request tester.
The model is built from three sources, in order of authority:
-
Route discovery — the router and the REST resource plugins
provide the paths, HTTP methods, authentication providers and owning module. -
Reflection — the class and method behind each route give the
{token}path parameters and a best-effort scan for the query
keys the code reads. -
Docblock annotations — everything that cannot be inferred
from the code: summaries, parameter types, request and response schemas,
examples.
Each operation is reported as annotated, partial or
none, so a team can see at a glance how much of its API is actually
described.
Requirements
This module requires no other modules. It uses only Drupal core services and
the Symfony components core already ships.
These modules are optional. When present, the module reads their real
configuration instead of assuming anything:
-
REST (core) — to document routes served by REST resource
plugins. -
Basic Auth (core) — adds the
basic_authsecurity scheme. -
Key auth adds the
key_authscheme, using the header name that module
is configured with. -
Simple OAuth adds the
oauth2scheme, using that module's real token
endpoint. -
JWT adds the
jwt_authscheme. Itsjwt_auth_issuersubmodule also gives the tester a token
endpoint to fetch from.
Installation
Install as you would any contributed Drupal module. See Installing modules for further information.
Configuration
Visit Configuration › Web services › API documentation to browse the documentation, and its Settings tab to control
what is documented.
- Which modules to scan — either pick whole extension sources (custom, contributed, profile, core) or tick individual modules.
-
Path prefixes — one per line, for example
/api. Only routes under one of these prefixes are documented.
Leave the list empty to document every route on the site,
which combined with selecting every source gives a complete picture of the
APIs a site exposes. - Include REST resources / Include administrative routes — administrative pages are excluded by default, being rarely part of an API.
-
Maximum number of endpoints — discovery stops once this
many endpoints have been found, which keeps the page responsive on a
site-wide scan. Set it to0for no limit. - Docblock tag prefix — see below.
-
JWT header name — the header a JSON Web Token is sent in,
used by the tester and written into the specification. This cannot be
detected, so it is configured: leave it asAuthorization
unless your site reads another header. -
Drupal's JWT module accepts
JWT-Authorizationas well, and some sites patch it to require that one. -
Specification metadata — the title, version, description
and server URLs written into the generated specification. An empty title
uses the site name. - Interactive tester — turn off to render documentation only.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Openapi ecosystem
Most installed first