Connecting a Drupal site
Enable the required Drupal modules, allow JSON:API writes, create a publishing user, then test and connect the site in Connect a Site.
Drupal sites connect through JSON:API with a username and password (HTTP Basic Authentication). Posts are created as nodes of the content type you choose. This guide covers the Drupal preparation, the form fields and the most common errors.
Before you start
You are an Owner or Admin of the company in Accounts, or of its agency.
You have administrator access to the Drupal site.
You know the machine name of the content type posts should go into, for example
article.
Step 1: Enable the modules
The form lists the modules that must be enabled: "Please make sure these modules are enabled: HTTP Basic Authentication, JSON:API, Rest UI, RESTful Web Services and Serialization." In Drupal, enable:
HTTP Basic Authentication
JSON:API
REST UI
RESTful Web Services
Serialization
Step 2: Allow JSON:API to create content
JSON:API is read-only by default. In the JSON:API settings (Configuration > Web services > JSON:API), choose "Accept all JSON:API create, read, update, and delete operations". Publishing fails when write operations are turned off.
Step 3: Create a user for publishing
Create a Drupal user for the platform with permission to create, edit and delete content of your content type, and to use the Full HTML text format. Posts are sent with the body in Full HTML.
Step 4: Check the API address
Open https://your-site.com/jsonapi in a browser. You should see a JSON list of resources. If the site uses a different path, such as nl/jsonapi for a language-specific endpoint, note it for the API Prefix field.
Step 5: Open Connect a Site
In Accounts, go to Companies › Overview, open the company and click the Websites tab.
Click Connect a Site. The window opens with the connect form ready.
Under Select your CMS, choose Drupal. A notice lists the modules from step 1.
Step 6: Fill in the fields
Field | What to enter |
|---|---|
Drupal Site URL | The site address, for example |
Username | The Drupal user from step 3. |
Password | That user's password. |
API Prefix | Default: |
Content Type | Optional. The machine name of the content type. Default: |
Language Code | The language of the content, for example |
Use Field Description | Turn this on if the content type has a |
Step 7: Test the connection
Click Test connection. It becomes clickable once the URL, username, password and API prefix are filled in.
The test opens the API prefix, creates an unpublished "Test Article" of your content type and deletes it again.
When it passes, you see "Test connection successful! Credentials are valid." and Connect becomes clickable.
The test waits up to 5 seconds for each request, so a very slow site can fail the test even when the settings are right.
Step 8: Connect
Click Connect. The site name is read from Drupal's site settings, or the domain is used. The window closes and the site appears in the company's Websites list.
Changing the connection later
In Accounts, go to Websites › All Websites, open the site and click Edit connection. In Site settings, you can change Site name, Username, Password, Content type and Language code. Leave Password blank to keep the current one. A new username or password is tested before it is saved. Contact the UP-TO-DATE support team before disconnecting a site with existing posts, because disconnecting removes its posts and schedules from the platform.
Common errors
The line under each message in the form tells you what to do.
Message | What to check |
|---|---|
"Authentication failed. Please check your username and password." | Wrong username or password, or HTTP Basic Authentication isn't enabled. |
"No JSON:API found at ... (status ...). Check the site URL, the API prefix and that the JSON:API module is enabled." | The API Prefix or the URL is wrong, or JSON:API isn't enabled. |
"Authentication failed or this user is not allowed to create "..." content. Check the credentials and the user's permissions." | The user may not create this content type, or JSON:API only allows reading (step 2). |
"Could not create a test "..." item (status ...). Check the content type and the API prefix." | The content type name is wrong, or Drupal refused the test article, often because the content type has other required fields or no body field. When the message continues with "Drupal said:", that part is Drupal's own reason. |
"Unable to reach the Drupal site. Please check the URL." | The domain doesn't resolve or the server refused the connection. |
"The Drupal site took too long to respond. Please try again." | The site didn't answer within 5 seconds. |
"Failed to connect to Drupal: ..." | Read the reason at the end, or send the technical details to the UP-TO-DATE support team. |
"Unable to connect to Drupal JSON:API", "The requested Drupal resource was not found." or "Failed to connect Drupal site" | Connecting failed after a passed test. Test again, and contact the UP-TO-DATE support team if it keeps failing. |
Related articles
Did this answer your question?