Pantheon supports running WordPress and Drupal as an API (Application Programming Interface) for the backend of headless sites, which enables the CMS to interact with external frontend applications over HTTP requests.
For example, a mobile applicationthat uses the
DELETEHTTP methods to perform CRUD operations on a CMS's database .
WordPress and Drupal are traditionally monolithic CMSs, meaning they serve as the frontend and backend of a site. Decoupled architecture (headless) is a development model that uses a CMS to manage content in the backend with a completely separate frontend component to render that content in the browser.
Some key differences of decoupled architecture include:
Presentation can be handled in a variety of ways, from interactive JS frameworks like Angular, to static generators, to mobile apps, or even another CMS. Multiple frontends can peacefully coexist.
Content Via Web Service API
The content for the site is accessible via a web-service API, usually in a RESTful manner and in a mashup-friendly format such as JSON.
CMS Backend and Database
There is a traditional database-driven CMS which editors use to maintain the content for the site, usually via the same admin interface as always.
Backend APIs running on Pantheon take advantage of the following platform features for optimal performance:
- Global CDN: Cache backend API responses from WordPress or Drupal in 40+ global CHI metro POPs (points of presence).
- Redis: Leverage object caching for backend APIs that use the database-driven admin interface of the CMS to edit or add content. For details, see the following:
Running WordPress and Drupal as an API on Pantheon can be done on any Drupal or WordPress upstream. The process to create, update core, and launch a backend API on Pantheon does not deviate from the standard procedures.
Since WordPress 4.7, the WordPress API is included as part of core. There's no action needed to expose the API on Pantheon. Explore default routes and endpoints like
/wp-json/wp/v2/posts in your browser:
We recommend using a trusted browser extension to format the JSON response from the API so it's easier to read.
Refer to the Rest API Handbook from WordPress.org's Developer Resources for full documentation on this web service.
Web Services are implemented through various plugins in Drupal.
The service module has several integration features, and other web service formats. It also has several supporting modules that extend the Drupal functionalities made available to the API.
We recommend using one of the following Chrome extensions to debug HTTP requests: