SlideShare a Scribd company logo
1 of 39
Web APIs in Drupal 8
Larry Garfield, Senior Architect, Palantir.net
Kyle Browning, Technical Consultant, Acquia
Larry Garfield
Senior Architect, Palantir.net
Drupal Web Services Lead
Who are we?
Kyle Browning
Technical Consultant, Acquia
Services, and Drupal iOS SDK maintainer
Who are we?
What are Web Services(tm)?
The Internet (TCP/IP)
The Web (HTTP)
Web Services (non-HTML)
REST (REpresentational State Transfer)
Collection of Resources
Resource identified by URI
Resource represented in a format
Manipulate through Verbs/Methods
Known hyperlinks to other Resources
REST (Hypermedia)
So what's wrong with Drupal 7?
Drupal 7
function example_menu() {
$items['my/page'] = array(
'title' => 'My page',
'page callback' => 'my_page_function',
'access arguments' => array('access content'),
);
return $items;
}
Only map on path
Very basic access control
Drupal 7
function example_page_delivery_callback_alter(&$delivery_callback) {
if (...) {
$delivery_callback = 'example_deliver_page';
}
}
Happens after the page callback, so mostly useless.
Drupal 7
→And oh yeah, globals
▪ $_GET
▪ drupal_add_http_header()
▪ print
Drupal 7
Everything other than a full HTML page is an after-thought.
So what's better in Drupal 8?
Drupal 8
example.route:
path: /my/page
defaults:
_controller: 'DrupalexampleControllerExampleController::page'
_title: 'Example page'
requirements:
_permission: 'access_examples'
_day: 'Tuesday'
_method: 'GET'
Multiple access checks
Map on path,
Drupal 8
Arbitrary custom logic goes here
Drupal 8
Theming and page layout happen here
Drupal 8
Everything's an HTTP Response. Sometimes that's a page.
Drupal 8
→You can serve any type of response to a request
→Wire directly to the routing system.
→No duplicating routing anymore!
Drupal 8 - Serialization module
→Standard serialization/deserialization pipeline
→Built on Symfony Serializer component
$json = $this->serializer->serialize($entity, 'json');
$xml = $this->serializer->serialize($entity, 'xml');
$entity = $this->serializer->deserialize($json, 'Node' 'json');
Standard universal serialized format (for internal structure)!
Drupal 8 - REST module
→Core module for common pattern of REST usage
→~RestWS
→Uses Serialization
→Define "Resource" Plugins
▪ GET/get(), PUT/put(), DELETE/delete()
▪ Return ResourceResponse
▪ Drupal will serialize()/deserialize() for you
Drupal 8 - REST resources
class DBLogResource extends ResourceBase {
public function get($id = NULL) {
if ($id) {
$record = db_query("SELECT * FROM {watchdog} WHERE wid = :wid", [':wid' => $id])
->fetchAssoc();
if (!empty($record)) {
return new ResourceResponse($record);
}
throw new NotFoundHttpException(t('Log entry with ID @id was not found', ['@id' => $id]));
}
throw new HttpException(t('No log entry ID was provided'));
}
}
Drupal 8 - REST resources
All Content Entities are supported out-of-the-box
● Uses same URL as HTML page
● All supported formats, automatically
● Opt-in configuration
Easily add your own resources, too
Teach serializer about it (Normalizer)
Create new Resource plugin
Profit!!1!
Drupal 8 - Content Negotiation
Reverse proxies suck
+
Browsers suck even more
=
Accept-based negotiation is broken 90% of the time :-(
Drupal 8 - Content Negotiation
http://example.com/node/5?&_format=hal_json
http://example.com/node/5?&_format=xml
http://example.com/node/5?&_format=html (default)
Drupal 8
REST UI
Drupal 8
REST UI
Drupal 8 - Hypermedia Links
Coming soon!
(8.1? As soon as someone works on it.)
https://www.drupal.org/node/2113345
What does Services module do?
Drupal 8 - Services
→Provide endpoint capabilities to put your API behind a
centralized URL
→Standardize on an approach to building non-REST
APIs
→Accept Header content negotiation
→Gives us regular json response instead of hal_json
→Config entities too!
Drupal 8 - ServicesDefinition
→Defines the ‘resource’
→Protein of Services in
D8
→Route Access
→Request method
Drupal 8 - ServicesDefinition
Still respects core
Config Entities!
Lets grab a block
Create a block
Update a block
And since everything is an entity.
Drupal 8 - Views
Respects Permissions
Thank You

More Related Content

What's hot

Whats New in the Http Service Specification - Felix Meschberger
Whats New in the Http Service Specification - Felix MeschbergerWhats New in the Http Service Specification - Felix Meschberger
Whats New in the Http Service Specification - Felix Meschbergermfrancis
 
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingJace Ju
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswanivvaswani
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkRed Hat Developers
 
Service Oriented Web Development with OSGi - C Ziegeler
Service Oriented Web Development with OSGi - C ZiegelerService Oriented Web Development with OSGi - C Ziegeler
Service Oriented Web Development with OSGi - C Ziegelermfrancis
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationJace Ju
 
Alfresco study37 alfresco_ng2_components
Alfresco study37 alfresco_ng2_componentsAlfresco study37 alfresco_ng2_components
Alfresco study37 alfresco_ng2_componentsTakeshi Totani
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsNeil Crookes
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Keir Bowden
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Spring java config
Spring java configSpring java config
Spring java configSukjin Yun
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsAndré Tapia
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 updateJoshua Long
 

What's hot (20)

Whats New in the Http Service Specification - Felix Meschberger
Whats New in the Http Service Specification - Felix MeschbergerWhats New in the Http Service Specification - Felix Meschberger
Whats New in the Http Service Specification - Felix Meschberger
 
CodeIgniter 3.0
CodeIgniter 3.0CodeIgniter 3.0
CodeIgniter 3.0
 
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstrapingWhat happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
 
REST API with CakePHP
REST API with CakePHPREST API with CakePHP
REST API with CakePHP
 
Code Igniter 2
Code Igniter 2Code Igniter 2
Code Igniter 2
 
Frontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and HowFrontend Servers and NGINX: What, Where and How
Frontend Servers and NGINX: What, Where and How
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
 
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech TalkContract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
Contract-driven development with OpenAPI 3 and Vert.x | DevNation Tech Talk
 
Service Oriented Web Development with OSGi - C Ziegeler
Service Oriented Web Development with OSGi - C ZiegelerService Oriented Web Development with OSGi - C Ziegeler
Service Oriented Web Development with OSGi - C Ziegeler
 
Diving into php
Diving into phpDiving into php
Diving into php
 
Head First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & ApplicationHead First Zend Framework - Part 1 Project & Application
Head First Zend Framework - Part 1 Project & Application
 
Alfresco study37 alfresco_ng2_components
Alfresco study37 alfresco_ng2_componentsAlfresco study37 alfresco_ng2_components
Alfresco study37 alfresco_ng2_components
 
Designing CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIsDesigning CakePHP plugins for consuming APIs
Designing CakePHP plugins for consuming APIs
 
Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet Salesforce CLI Cheat Sheet
Salesforce CLI Cheat Sheet
 
WebGUI Developers Workshop
WebGUI Developers WorkshopWebGUI Developers Workshop
WebGUI Developers Workshop
 
Node.js and Parse
Node.js and ParseNode.js and Parse
Node.js and Parse
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Spring java config
Spring java configSpring java config
Spring java config
 
JWT - Sécurisez vos APIs
JWT - Sécurisez vos APIsJWT - Sécurisez vos APIs
JWT - Sécurisez vos APIs
 
the Spring 4 update
the Spring 4 updatethe Spring 4 update
the Spring 4 update
 

Viewers also liked

Headless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal MeetupHeadless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal MeetupPratomo Ardianto
 
Introducing Acquia Content Hub: Take Control of Your Content Chaos
Introducing Acquia Content Hub: Take Control of Your Content ChaosIntroducing Acquia Content Hub: Take Control of Your Content Chaos
Introducing Acquia Content Hub: Take Control of Your Content ChaosAcquia
 
Use Content to Enhance Your Commerce Experience
Use Content to Enhance Your Commerce ExperienceUse Content to Enhance Your Commerce Experience
Use Content to Enhance Your Commerce ExperienceAcquia
 
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...Acquia
 
Entities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalEntities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalAcquia
 
Applied progressive decoupling weather.com, angular, and drupal
Applied progressive decoupling  weather.com, angular, and drupalApplied progressive decoupling  weather.com, angular, and drupal
Applied progressive decoupling weather.com, angular, and drupalAcquia
 
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016Prateek Jain
 
What Is a Cloud-first Headless CMS
What Is a Cloud-first Headless CMSWhat Is a Cloud-first Headless CMS
What Is a Cloud-first Headless CMSKentico Software
 
Going Global 101: How to Manage Your Websites Worldwide Using Drupal
Going Global 101: How to Manage Your Websites Worldwide Using DrupalGoing Global 101: How to Manage Your Websites Worldwide Using Drupal
Going Global 101: How to Manage Your Websites Worldwide Using DrupalAcquia
 
Introducing Workspace Preview System: Solve Your Content Preview Problems
Introducing Workspace Preview System: Solve Your Content Preview ProblemsIntroducing Workspace Preview System: Solve Your Content Preview Problems
Introducing Workspace Preview System: Solve Your Content Preview ProblemsAcquia
 
The Future of a Content-Driven World: How To Prepare Your Team
The Future of a Content-Driven World: How To Prepare Your TeamThe Future of a Content-Driven World: How To Prepare Your Team
The Future of a Content-Driven World: How To Prepare Your TeamAcquia
 
How to Successfully Implement Headless Drupal
How to Successfully Implement Headless DrupalHow to Successfully Implement Headless Drupal
How to Successfully Implement Headless DrupalAcquia
 
How Wilson Sporting Goods Is Changing the Game with Experiential Commerce
 How Wilson Sporting Goods Is Changing the Game with Experiential Commerce How Wilson Sporting Goods Is Changing the Game with Experiential Commerce
How Wilson Sporting Goods Is Changing the Game with Experiential CommerceAcquia
 
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...Acquia
 
Acquia Content Hub: Connect Technologies & Extend Systems to Source Content
Acquia Content Hub: Connect Technologies & Extend Systems to Source ContentAcquia Content Hub: Connect Technologies & Extend Systems to Source Content
Acquia Content Hub: Connect Technologies & Extend Systems to Source ContentAcquia
 
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big Module
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big ModuleUpdating the Salesforce Suite to Drupal 8: Major Changes for a Big Module
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big ModuleAcquia
 
Decoupled Drupal Showcase: Using Drupal to Power Digital Signage
Decoupled Drupal Showcase: Using Drupal to Power Digital SignageDecoupled Drupal Showcase: Using Drupal to Power Digital Signage
Decoupled Drupal Showcase: Using Drupal to Power Digital SignageAcquia
 
Open Y: One Digital Platform for all YMCAs
Open Y: One Digital Platform for all YMCAsOpen Y: One Digital Platform for all YMCAs
Open Y: One Digital Platform for all YMCAsAcquia
 
A Future-Focused Digital Platform with Drupal 8
A Future-Focused Digital Platform with Drupal 8A Future-Focused Digital Platform with Drupal 8
A Future-Focused Digital Platform with Drupal 8Acquia
 

Viewers also liked (20)

Headless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal MeetupHeadless Drupal, Singapore Drupal Meetup
Headless Drupal, Singapore Drupal Meetup
 
Introducing Acquia Content Hub: Take Control of Your Content Chaos
Introducing Acquia Content Hub: Take Control of Your Content ChaosIntroducing Acquia Content Hub: Take Control of Your Content Chaos
Introducing Acquia Content Hub: Take Control of Your Content Chaos
 
Mb Portfolio 20091201
Mb Portfolio 20091201Mb Portfolio 20091201
Mb Portfolio 20091201
 
Use Content to Enhance Your Commerce Experience
Use Content to Enhance Your Commerce ExperienceUse Content to Enhance Your Commerce Experience
Use Content to Enhance Your Commerce Experience
 
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
Responsive & Ready: Why Drupal 8 is Ideal for Building Mobile-first Experienc...
 
Entities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in DrupalEntities 101: Understanding Data Structures in Drupal
Entities 101: Understanding Data Structures in Drupal
 
Applied progressive decoupling weather.com, angular, and drupal
Applied progressive decoupling  weather.com, angular, and drupalApplied progressive decoupling  weather.com, angular, and drupal
Applied progressive decoupling weather.com, angular, and drupal
 
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016
Build Mobile Applications with Headless Drupal 8 - DrupalConAsia 2016
 
What Is a Cloud-first Headless CMS
What Is a Cloud-first Headless CMSWhat Is a Cloud-first Headless CMS
What Is a Cloud-first Headless CMS
 
Going Global 101: How to Manage Your Websites Worldwide Using Drupal
Going Global 101: How to Manage Your Websites Worldwide Using DrupalGoing Global 101: How to Manage Your Websites Worldwide Using Drupal
Going Global 101: How to Manage Your Websites Worldwide Using Drupal
 
Introducing Workspace Preview System: Solve Your Content Preview Problems
Introducing Workspace Preview System: Solve Your Content Preview ProblemsIntroducing Workspace Preview System: Solve Your Content Preview Problems
Introducing Workspace Preview System: Solve Your Content Preview Problems
 
The Future of a Content-Driven World: How To Prepare Your Team
The Future of a Content-Driven World: How To Prepare Your TeamThe Future of a Content-Driven World: How To Prepare Your Team
The Future of a Content-Driven World: How To Prepare Your Team
 
How to Successfully Implement Headless Drupal
How to Successfully Implement Headless DrupalHow to Successfully Implement Headless Drupal
How to Successfully Implement Headless Drupal
 
How Wilson Sporting Goods Is Changing the Game with Experiential Commerce
 How Wilson Sporting Goods Is Changing the Game with Experiential Commerce How Wilson Sporting Goods Is Changing the Game with Experiential Commerce
How Wilson Sporting Goods Is Changing the Game with Experiential Commerce
 
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...
From Stone Age-worthy Sites to Cohesive Content: How Trinity University is Us...
 
Acquia Content Hub: Connect Technologies & Extend Systems to Source Content
Acquia Content Hub: Connect Technologies & Extend Systems to Source ContentAcquia Content Hub: Connect Technologies & Extend Systems to Source Content
Acquia Content Hub: Connect Technologies & Extend Systems to Source Content
 
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big Module
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big ModuleUpdating the Salesforce Suite to Drupal 8: Major Changes for a Big Module
Updating the Salesforce Suite to Drupal 8: Major Changes for a Big Module
 
Decoupled Drupal Showcase: Using Drupal to Power Digital Signage
Decoupled Drupal Showcase: Using Drupal to Power Digital SignageDecoupled Drupal Showcase: Using Drupal to Power Digital Signage
Decoupled Drupal Showcase: Using Drupal to Power Digital Signage
 
Open Y: One Digital Platform for all YMCAs
Open Y: One Digital Platform for all YMCAsOpen Y: One Digital Platform for all YMCAs
Open Y: One Digital Platform for all YMCAs
 
A Future-Focused Digital Platform with Drupal 8
A Future-Focused Digital Platform with Drupal 8A Future-Focused Digital Platform with Drupal 8
A Future-Focused Digital Platform with Drupal 8
 

Similar to Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core

What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?Alexandru Badiu
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in PerlLaurent Dami
 
Intro to php
Intro to phpIntro to php
Intro to phpSp Singh
 
Flask and Angular: An approach to build robust platforms
Flask and Angular:  An approach to build robust platformsFlask and Angular:  An approach to build robust platforms
Flask and Angular: An approach to build robust platformsAyush Sharma
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejsNick Lee
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCalderaLearn
 
Create a res tful services api in php.
Create a res tful services api in php.Create a res tful services api in php.
Create a res tful services api in php.Adeoye Akintola
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web ArtisansRaf Kewl
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기Juwon Kim
 
Progressive Enhancment with Rails and React
Progressive Enhancment with Rails and ReactProgressive Enhancment with Rails and React
Progressive Enhancment with Rails and ReactTyler Johnston
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Headless Drupal en pratique
Headless Drupal en pratiqueHeadless Drupal en pratique
Headless Drupal en pratiqueSimon Morvan
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011camp_drupal_ua
 

Similar to Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core (20)

What's new in the Drupal 7 API?
What's new in the Drupal 7 API?What's new in the Drupal 7 API?
What's new in the Drupal 7 API?
 
Fatc
FatcFatc
Fatc
 
Doctrine and NoSQL
Doctrine and NoSQLDoctrine and NoSQL
Doctrine and NoSQL
 
Doctrine for NoSQL
Doctrine for NoSQLDoctrine for NoSQL
Doctrine for NoSQL
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Flask and Angular: An approach to build robust platforms
Flask and Angular:  An approach to build robust platformsFlask and Angular:  An approach to build robust platforms
Flask and Angular: An approach to build robust platforms
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
 
Create a res tful services api in php.
Create a res tful services api in php.Create a res tful services api in php.
Create a res tful services api in php.
 
Laravel for Web Artisans
Laravel for Web ArtisansLaravel for Web Artisans
Laravel for Web Artisans
 
RESTful API 제대로 만들기
RESTful API 제대로 만들기RESTful API 제대로 만들기
RESTful API 제대로 만들기
 
Progressive Enhancment with Rails and React
Progressive Enhancment with Rails and ReactProgressive Enhancment with Rails and React
Progressive Enhancment with Rails and React
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Drupal 8 migrate!
Drupal 8 migrate!Drupal 8 migrate!
Drupal 8 migrate!
 
Headless Drupal en pratique
Headless Drupal en pratiqueHeadless Drupal en pratique
Headless Drupal en pratique
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
 

More from Acquia

Acquia_Adcetera Webinar_Marketing Automation.pdf
Acquia_Adcetera Webinar_Marketing Automation.pdfAcquia_Adcetera Webinar_Marketing Automation.pdf
Acquia_Adcetera Webinar_Marketing Automation.pdfAcquia
 
Acquia Webinar Deck - 9_13 .pdf
Acquia Webinar Deck - 9_13 .pdfAcquia Webinar Deck - 9_13 .pdf
Acquia Webinar Deck - 9_13 .pdfAcquia
 
Taking Your Multi-Site Management at Scale to the Next Level
Taking Your Multi-Site Management at Scale to the Next LevelTaking Your Multi-Site Management at Scale to the Next Level
Taking Your Multi-Site Management at Scale to the Next LevelAcquia
 
CDP for Retail Webinar with Appnovation - Q2 2022.pdf
CDP for Retail Webinar with Appnovation - Q2 2022.pdfCDP for Retail Webinar with Appnovation - Q2 2022.pdf
CDP for Retail Webinar with Appnovation - Q2 2022.pdfAcquia
 
May Partner Bootcamp 2022
May Partner Bootcamp 2022May Partner Bootcamp 2022
May Partner Bootcamp 2022Acquia
 
April Partner Bootcamp 2022
April Partner Bootcamp 2022April Partner Bootcamp 2022
April Partner Bootcamp 2022Acquia
 
How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story Acquia
 
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXUsing Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXAcquia
 
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowImprove Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowAcquia
 
September Partner Bootcamp
September Partner BootcampSeptember Partner Bootcamp
September Partner BootcampAcquia
 
August partner bootcamp
August partner bootcampAugust partner bootcamp
August partner bootcampAcquia
 
July 2021 Partner Bootcamp
July  2021 Partner BootcampJuly  2021 Partner Bootcamp
July 2021 Partner BootcampAcquia
 
May Partner Bootcamp
May Partner BootcampMay Partner Bootcamp
May Partner BootcampAcquia
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYDRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYAcquia
 
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineWork While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineAcquia
 
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia
 
April partner bootcamp deck cookieless future
April partner bootcamp deck  cookieless futureApril partner bootcamp deck  cookieless future
April partner bootcamp deck cookieless futureAcquia
 
How to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsHow to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsAcquia
 
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...Acquia
 
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Acquia
 

More from Acquia (20)

Acquia_Adcetera Webinar_Marketing Automation.pdf
Acquia_Adcetera Webinar_Marketing Automation.pdfAcquia_Adcetera Webinar_Marketing Automation.pdf
Acquia_Adcetera Webinar_Marketing Automation.pdf
 
Acquia Webinar Deck - 9_13 .pdf
Acquia Webinar Deck - 9_13 .pdfAcquia Webinar Deck - 9_13 .pdf
Acquia Webinar Deck - 9_13 .pdf
 
Taking Your Multi-Site Management at Scale to the Next Level
Taking Your Multi-Site Management at Scale to the Next LevelTaking Your Multi-Site Management at Scale to the Next Level
Taking Your Multi-Site Management at Scale to the Next Level
 
CDP for Retail Webinar with Appnovation - Q2 2022.pdf
CDP for Retail Webinar with Appnovation - Q2 2022.pdfCDP for Retail Webinar with Appnovation - Q2 2022.pdf
CDP for Retail Webinar with Appnovation - Q2 2022.pdf
 
May Partner Bootcamp 2022
May Partner Bootcamp 2022May Partner Bootcamp 2022
May Partner Bootcamp 2022
 
April Partner Bootcamp 2022
April Partner Bootcamp 2022April Partner Bootcamp 2022
April Partner Bootcamp 2022
 
How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story How to Unify Brand Experience: A Hootsuite Story
How to Unify Brand Experience: A Hootsuite Story
 
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CXUsing Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
Using Personas to Guide DAM Results: How Life Time Pumped Up Their UX and CX
 
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development WorkflowImprove Code Quality and Time to Market: 100% Cloud-Based Development Workflow
Improve Code Quality and Time to Market: 100% Cloud-Based Development Workflow
 
September Partner Bootcamp
September Partner BootcampSeptember Partner Bootcamp
September Partner Bootcamp
 
August partner bootcamp
August partner bootcampAugust partner bootcamp
August partner bootcamp
 
July 2021 Partner Bootcamp
July  2021 Partner BootcampJuly  2021 Partner Bootcamp
July 2021 Partner Bootcamp
 
May Partner Bootcamp
May Partner BootcampMay Partner Bootcamp
May Partner Bootcamp
 
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASYDRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
DRUPAL 7 END OF LIFE IS NEAR - MIGRATE TO DRUPAL 9 FAST AND EASY
 
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead MachineWork While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
Work While You Sleep: The CMO’s Guide to a 24/7/365 Lead Machine
 
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B LeadsAcquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
Acquia webinar: Leveraging Drupal to Bury Your Sales Team In B2B Leads
 
April partner bootcamp deck cookieless future
April partner bootcamp deck  cookieless futureApril partner bootcamp deck  cookieless future
April partner bootcamp deck cookieless future
 
How to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutionsHow to enhance cx through personalised, automated solutions
How to enhance cx through personalised, automated solutions
 
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
DRUPAL MIGRATIONS AND DRUPAL 9 INNOVATION: HOW PAC-12 DELIVERED DIGITALLY FOR...
 
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
Customer Experience (CX): 3 Key Factors Shaping CX Redesign in 2021
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

Drupal 8 Deep Dive: What It Means for Developers Now that REST Is in Core

  • 1. Web APIs in Drupal 8 Larry Garfield, Senior Architect, Palantir.net Kyle Browning, Technical Consultant, Acquia
  • 2. Larry Garfield Senior Architect, Palantir.net Drupal Web Services Lead Who are we?
  • 3. Kyle Browning Technical Consultant, Acquia Services, and Drupal iOS SDK maintainer Who are we?
  • 4. What are Web Services(tm)?
  • 5. The Internet (TCP/IP) The Web (HTTP) Web Services (non-HTML) REST (REpresentational State Transfer)
  • 6. Collection of Resources Resource identified by URI Resource represented in a format Manipulate through Verbs/Methods Known hyperlinks to other Resources REST (Hypermedia)
  • 7. So what's wrong with Drupal 7?
  • 8. Drupal 7 function example_menu() { $items['my/page'] = array( 'title' => 'My page', 'page callback' => 'my_page_function', 'access arguments' => array('access content'), ); return $items; } Only map on path Very basic access control
  • 9. Drupal 7 function example_page_delivery_callback_alter(&$delivery_callback) { if (...) { $delivery_callback = 'example_deliver_page'; } } Happens after the page callback, so mostly useless.
  • 10. Drupal 7 →And oh yeah, globals ▪ $_GET ▪ drupal_add_http_header() ▪ print
  • 11. Drupal 7 Everything other than a full HTML page is an after-thought.
  • 12. So what's better in Drupal 8?
  • 13. Drupal 8 example.route: path: /my/page defaults: _controller: 'DrupalexampleControllerExampleController::page' _title: 'Example page' requirements: _permission: 'access_examples' _day: 'Tuesday' _method: 'GET' Multiple access checks Map on path,
  • 14. Drupal 8 Arbitrary custom logic goes here
  • 15. Drupal 8 Theming and page layout happen here
  • 16. Drupal 8 Everything's an HTTP Response. Sometimes that's a page.
  • 17. Drupal 8 →You can serve any type of response to a request →Wire directly to the routing system. →No duplicating routing anymore!
  • 18. Drupal 8 - Serialization module →Standard serialization/deserialization pipeline →Built on Symfony Serializer component $json = $this->serializer->serialize($entity, 'json'); $xml = $this->serializer->serialize($entity, 'xml'); $entity = $this->serializer->deserialize($json, 'Node' 'json'); Standard universal serialized format (for internal structure)!
  • 19. Drupal 8 - REST module →Core module for common pattern of REST usage →~RestWS →Uses Serialization →Define "Resource" Plugins ▪ GET/get(), PUT/put(), DELETE/delete() ▪ Return ResourceResponse ▪ Drupal will serialize()/deserialize() for you
  • 20. Drupal 8 - REST resources class DBLogResource extends ResourceBase { public function get($id = NULL) { if ($id) { $record = db_query("SELECT * FROM {watchdog} WHERE wid = :wid", [':wid' => $id]) ->fetchAssoc(); if (!empty($record)) { return new ResourceResponse($record); } throw new NotFoundHttpException(t('Log entry with ID @id was not found', ['@id' => $id])); } throw new HttpException(t('No log entry ID was provided')); } }
  • 21. Drupal 8 - REST resources All Content Entities are supported out-of-the-box ● Uses same URL as HTML page ● All supported formats, automatically ● Opt-in configuration Easily add your own resources, too Teach serializer about it (Normalizer) Create new Resource plugin Profit!!1!
  • 22. Drupal 8 - Content Negotiation Reverse proxies suck + Browsers suck even more = Accept-based negotiation is broken 90% of the time :-(
  • 23. Drupal 8 - Content Negotiation http://example.com/node/5?&_format=hal_json http://example.com/node/5?&_format=xml http://example.com/node/5?&_format=html (default)
  • 26. Drupal 8 - Hypermedia Links Coming soon! (8.1? As soon as someone works on it.) https://www.drupal.org/node/2113345
  • 27. What does Services module do?
  • 28. Drupal 8 - Services →Provide endpoint capabilities to put your API behind a centralized URL →Standardize on an approach to building non-REST APIs →Accept Header content negotiation →Gives us regular json response instead of hal_json →Config entities too!
  • 29. Drupal 8 - ServicesDefinition →Defines the ‘resource’ →Protein of Services in D8 →Route Access →Request method
  • 30. Drupal 8 - ServicesDefinition
  • 33. Lets grab a block
  • 36. And since everything is an entity.
  • 37. Drupal 8 - Views