drupal / webapi_starter
The basic Drupal API site template: JSON:API served from /api with OAuth 2.0 and Swagger UI documentation, on the standard Drupal content model.
Package info
git.drupalcode.org/project/webapi_starter.git
Type:drupal-recipe
pkg:composer/drupal/webapi_starter
Requires
- drupal/core: ^11.4 || ^12
- drupal/webapi: ^1
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The basic Drupal API site template.
A site template for the Webships installer. It keeps the standard Drupal content model and adds a documented API:
- JSON:API served from
/api, and read-only. - OAuth 2.0 with Simple OAuth and consumers, and HTTP Basic authentication.
- OpenAPI documents for JSON:API and REST, rendered with Swagger UI at
/api-docs. - The Drupal core administration theme for the back end and the front end.
- Registration is closed: an administrator creates the accounts.
Everything comes from drupal.org.
Install
With the Webships Project template:
ddev composer create-project drupal/webships_project:^1.0
ddev drush si -y webships --account-name=webmaster installer_site_template_form.add_ons=webapi_starter
Or apply the recipe on an existing site:
ddev composer require drupal/webapi_starter
ddev drush recipe recipes/webapi_starter
Write operations
JSON:API is read-only, which is what the Drupal Security Team recommends. Turn
write operations on at /admin/config/services/jsonapi only when the site needs
them, and rebuild the cache afterwards.
Cross-origin requests
CORS lives in sites/default/services.yml under cors.config. No module or
recipe can ship it, so set it per site.