Drupal Integration
How to connect SitePulse to Drupal for CMS patching — REST API and JSON:API configuration, image alt text, meta fields, and module requirements.
SitePulse connects to Drupal via JSON:API (Drupal 8.7+) or the Drupal REST API (Drupal 8.x). JSON:API is preferred — it is enabled by default in Drupal 9+ and provides a consistent field structure. The Metatag module is recommended for SEO field access.
Prerequisites
- Drupal 8.7 or later
- JSON:API module enabled (core in Drupal 9+,
drupal/jsonapiin Drupal 8) - A Drupal user account with Content Editor role or custom role with node edit permissions
- Basic Auth or OAuth2 authentication (see below)
- HTTPS on your Drupal site
Recommended modules
| Module | Purpose | Required? |
|---|---|---|
Metatag (drupal/metatag) | Provides separate meta title and meta description fields | Recommended |
Simple OAuth (drupal/simple_oauth) | OAuth2 client credentials for API auth | Optional (Basic Auth works) |
| JSON:API | REST interface with consistent field structure | Required (core in D9+) |
Authentication options
SitePulse supports two authentication methods for Drupal:
Basic Authentication
The simplest option. Enable the basic_auth module and use your Drupal username and password directly in SitePulse. Requires HTTPS — credentials are sent as a Base64-encoded header.
- Enable
basic_authmodule:drush en basic_auth - In SitePulse: Project → Settings → Integrations → Connect Drupal
- Enter your Drupal site URL, username, and password.
OAuth2 (recommended for production)
Use the Simple OAuth module to create a client credentials grant. This avoids storing user passwords in SitePulse.
- Install:
composer require drupal/simple_oauth && drush en simple_oauth - Generate keys:
drush simple-oauth:generate-keys ../private - Create an OAuth2 client with the
client_credentialsgrant type. - In SitePulse: enter the Client ID and Client Secret.
Connect Drupal in SitePulse
- Go to your project → Settings → Integrations.
- Click Connect Drupal.
- Enter:
- Drupal URL — your site root (e.g.
https://example.com) - Auth method — Basic Auth or OAuth2
- Credentials for your chosen method
- Drupal URL — your site root (e.g.
- Click Test Connection — SitePulse will call
GET /jsonapito verify. - Click Save.
What SitePulse can patch
| Field | API endpoint | Module required |
|---|---|---|
| SEO title | PATCH /jsonapi/node/{type}/{uuid} → metatag.title | Metatag |
| Meta description | PATCH /jsonapi/node/{type}/{uuid} → metatag.description | Metatag |
| Node title (H1) | PATCH /jsonapi/node/{type}/{uuid} → attributes.title | None |
| Image alt text | PATCH /jsonapi/file/file/{uuid} → attributes.description (or field_image.alt) | None |
| JSON-LD schema | Injected via Metatag's JSON-LD field or body content | Metatag |
Without the Metatag module, SitePulse falls back to patching attributes.title (the node title) for title changes only. Meta description patches require Metatag.
Metatag module field mapping
When Metatag is installed, SitePulse detects it by checking for the metatag resource in the JSON:API schema. Patches are sent as:
{
"data": {
"type": "node--article",
"id": "{uuid}",
"attributes": {
"metatag": [
{ "tag": "meta", "attributes": { "name": "title", "content": "New Title" } },
{ "tag": "meta", "attributes": { "name": "description", "content": "New description." } }
]
}
}
}Image alt text
Drupal stores image alt text on the media entity or as an inline field on the entity referencing the image. SitePulse patches field_image[alt] (the most common field name) via JSON:API. If your content type uses a different image field name, configure it in Project Settings → Integrations → Drupal → Advanced.
Required permissions
The authenticated user must have:
edit any <content-type> content— to patch node fieldsedit any file— to patch image alt textaccess content— to read entity data
Troubleshooting
"401 Unauthorized" with Basic Auth
Confirm basic_auth module is enabled. Some hosting providers (Pantheon, Acquia) require HTTPS for Basic Auth to work.
"403 Forbidden" on patch
The user account does not have edit permissions for the content type. Assign the Content Editor role or grant edit any <type> content permission.
"404 Not Found" on JSON:API endpoint
Verify the JSON:API module is enabled: drush pm:list | grep jsonapi. The JSON:API base path is /jsonapi by default.
Metatag not detected Ensure Metatag is both installed AND the metatag values are enabled for the content type being audited. Go to Admin → Configuration → Search and metadata → Metatag to verify.
Drupal multisite
SitePulse connects to a single Drupal site. For Drupal multisite installations, configure a separate SitePulse project and integration per site using the individual site domain.