Secrets of The Decoupled Drupal Practitioner
Secrets of The Decoupled Drupal Practitioner
Gatsby’s ecosystem
✋
Come say Hi!
@gatsbyjs
Meet me and members of the
github.com/gatsbyjs/gatsby Gatsby team at booth #319!
www.gatsbyjs.org
Decoupled Drupal in Practice
Pre-order now:
tiny.cc/decoupled-in-practice
4
Call for papers Sponsorships @decoupleddays
The Decoupled Days 2019 call For sponsorship information, Follow us on Twitter to stay
for papers is extended until reach out to our team at updated on important
May 3, 2019 at 11:59pm EST. [email protected]. announcements.
1 A brisk reintroduction
to decoupled Drupal
Drupal front end
Client Client
Server Server
Drupal
Monolithic Drupal
HTTP request
Decoupled
Web service HTTP client
HTTP response application
Other
language Decoupled application
Drupal front end
Templates Templates
PHP
Web service
JSON
Drupal
PHP
Drupal
Data Data
Server Server
JavaScript framework
(server-side
Drupal
execution)
Node.js
Drupal
Server-side JavaScript
Synchronous Lorem ipsum Subscribe
dolor sit
Asynchronous
amet, E-mail
consectetuer
adipiscing. Submit
JavaScript framework
(client-side execution) HTTP
request Lorem ipsum
Subscribe to our newsletter
dolor sit
Client E-mail address
amet,
consectetuer
Server adipiscing. Submit
JavaScript framework
(server-side
execution)
Lorem ipsum Success!
Node.js dolor sit Here are
HTTP amet, others that
request
consectetuer might interest
adipiscing. you:
Drupal
responds
Node.js
executes
JavaScript framework
renders
flush
HTML HTML
bindings by
JavaScript framework
Synchronous
Node.js
calls
responds REST executes
API
bindings by
JavaScript framework
Synchronous
2 An alternative API:
RELAXed Web Services
RELAXed Web Services
https://www.drupal.org/project/relaxed
Drupal core Depends on
(with HAL normalization) REST and Serialization
REST Waterwheel
depends on
Depends on Serialization
Drupal core
(raw JSON structures, no HAL) GraphQL
RELAXed Web
Core REST JSON API GraphQL
Services
REST APIs
Web services
HTML
JSON
Command line
Installing RELAXed
{
"couchdb": "Welcome",
"uuid": "02286a1b231b68d89624d281cdfc0404",
"vendor": {
"name": "Drupal",
"version": "8.5.6",
},
"version": "8.5.6"
}
Retrieving with RELAXed
https://www.drupal.org/project/jsonrpc
Installing JSON-RPC
{
"jsonrpc": "2.0",
"method": "cache.rebuild",
}
Retrieve a user’s permissions
{
"jsonrpc": "2.0",
"method": "user_permissions.list",
"params": {
"page": {
"limit": 5,
"offset": 0
}
},
"id": 2
}
Other common methods
https://www.drupal.org/project/schemata
Installing Schemata
● Format:
/schemata/{entity_type}/{bundle}?_format={output_f
ormat}&_describes={described_format}
● /schemata/node/article?_format=schema_json&describ
es=api_json
● /schemata/user?_format=schema_json&describes=hal_j
son
Sample Schemata response for articles
OpenAPI
https://www.drupal.org/project/openapi
Installing OpenAPI
# Use ReDoc.
$ composer require drupal/openapi
$ composer require drupal/openapi_ui_redoc
$ drush en -y openapi openapi_ui_redoc
https://github.com/contentacms/contentajs
Contenta CMS and Contenta.js
● Mentored Contribution
○ 9:00-18:00, Room 602
● First-Time Contributor Workshop
○ 9:00-12:00, Room 606
● General Contribution
○ 9:00-18:00, Room 6A
What did you think of this session? Locate this session on the
DrupalCon website: https://events.drupal.org/seattle2019/schedule
Thank you!
Gatsby’s ecosystem
✋
Come say Hi!
@gatsbyjs
Meet me and members of the
github.com/gatsbyjs/gatsby Gatsby team at booth #319!
www.gatsbyjs.org
Decoupled Drupal in Practice
Pre-order now:
tiny.cc/decoupled-in-practice
64
Call for papers Sponsorships @decoupleddays
The Decoupled Days 2019 call For sponsorship information, Follow us on Twitter to stay
for papers is extended until reach out to our team at updated on important
May 3, 2019 at 11:59pm EST. [email protected]. announcements.