SlideShare a Scribd company logo
1 of 78
Download to read offline
T H E W O R D P R E S S
R E S T A P I
D A V I D B I S S E T
@dimensionmedia
W H AT I S A R E S T A P I ?
REpresentational State
Transfer Application
Programing Interface
W H A T I S A R E S T A P I ?
‣ Separation Between Client and Server
‣ Stateless: No State, You Should Get Same
Data From Same Requests
‣ Cacheable
‣ Layerable: Load-Balancing, etc.
‣ Uniform: REST APIs typically tell you how to
access the data.
‣ Flexible: Doesn’t Matter Where Server/Client
Area, Or What They Are
‣ Simple: Uses Standard/Established Methods
C R U D A N D H T T P M E T H O D S
‣ CREATE -> POST
‣ READ -> GET
‣ UPDATE -> PUT
‣ DELETE -> DELETE
W H AT I S T H E
W P R E S T A P I ?
W O R D P R E S S +
R E S T A P I =
A W E S O M E S A U C E
R E Q U I R E M E N T S
‣ WordPress 4.4
‣ WP REST API Plugin 2.0
L E T ’ S D I V E I N !
P O S T M A N
https://www.getpostman.com/
Allows us to build and send
requests to our API and also
process and handle responses. A
really great tool for working with
any type of REST API, not just the
WordPress API.
http://local.wordpress.dev/wp-json
davidbisset.com/wp-json/wp/v2/posts/
davidbisset.com/wp-json/wp/v2/comments/
davidbisset.com/wp-json/wp/v2/media/
davidbisset.com/wp-json/wp/v2/media/1792
U S I N G C U R L &
W P _ H T T P
curl http://local.wordpress.dev/wp-json/wp/v2/posts
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, 

"http://local.wordpress.dev/wp-json/wp/v2/posts");
$json = curl_exec ($curl);
curl_close ($curl);
$data = json_decode($json);
var_dump($data);
$json = wp_remote_get

( 'http://local.wordpress.dev/wp-json/wp/v2/posts' );
$return = json_decode( $json['body'] );
var_dump($return);
W O R K I N G W I T H P O S T S
davidbisset.com/wp-json/wp/v2/posts/
davidbisset.com/wp-json/wp/v2/posts/1805
F I LT E R I N G P O S T S
/wp-json/wp/v2/posts/?filter[orderby]=rand
davidbisset.com/wp-json/wp/v2/posts/?filter[s]=dradcast
/wp-json/wp/v2/posts/?filter[posts_per_page]=1&filter[paged]=1&filter[s]=dradcast
PA G E S
/wp-json/wp/v2/pages/
P O S T M E TA
P O S T M E TA ( F I LT E R I N G )
davidbisset.com/wp-json/wp/v2/posts/?filter[meta_key]=test_meta
A U T H E N T I C AT I O N
T H E R E A R E 4 B A S I C T Y P E S O F
A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W:
‣ Basic Authentication – via a plugin
‣ Cookie Authentication – out of the box
‣ Oauth2 Authentication – via a plugin (third party)
‣ Oauth1 Authentication – via a plugin
T H E R E A R E 4 B A S I C T Y P E S O F
A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W:
‣ Basic Authentication – via a plugin
‣ Cookie Authentication – out of the box
‣ Oauth2 Authentication – via a plugin (third party)
‣ Oauth1 Authentication – via a plugin
B A S I C - A U T H
https://github.com/WP-API/Basic-Auth
TA D A ! B A S I C A U T H G E T S Y O U T H E S A M E
A C C E S S / R O L E S A S Y O U R W P U S E R
F O R E X A M P L E , I F Y O U H A V E A D M I N
A C C E S S Y O U C A N S E E A L L U S E R S
T H E R E A R E 4 B A S I C T Y P E S O F
A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W:
‣ Basic Authentication – via a plugin
‣ Cookie Authentication – out of the box
‣ Oauth2 Authentication – via a plugin (third party)
‣ Oauth1 Authentication – via a plugin
T H E R E A R E 4 B A S I C T Y P E S O F
A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W:
‣ Basic Authentication – via a plugin
‣ Cookie Authentication – out of the box
‣ Oauth2 Authentication – via a plugin (third party)
‣ Oauth1 Authentication – via a plugin
T H E R E A R E 4 B A S I C T Y P E S O F
A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W:
‣ Basic Authentication – via a plugin
‣ Cookie Authentication – out of the box
‣ Oauth2 Authentication – via a plugin (third party)
‣ Oauth1 Authentication – via a plugin
D I G G I N G I N T O T H E A P I :
C R E AT I N G A N E W P O S T
D I G G I N G I N T O T H E A P I :
A D D N I N G & U P D AT I N G P O S T
M E TA T O A P O S T
D I G G I N G I N T O T H E A P I :
D E L E T I N G A P O S T
W H Y T H I S I S C O O L
‣ “Reverse Mullet”: Business in back, party in the front
‣ You don’t have to write PHP (write what you want)
‣ WordPress Can Now Power Native Mobile
Applications
‣ Desktop Applications Possible
‣ More engaging user experience
‣ Offline: Control over failed connections, etc.
T H E M E S W I T H T H E
W O R D P R E S S R E S T A P I
B U I L D I N G A P L U G I N U S I N G
W P - A P I A N D A J A X
W H AT W E A R E B U I L D I N G
T H I N K A B O U T T H E A P I R E Q U E S T U R L
‣ New WordPress 4.4 Install
‣ Used FakerPress To Add Random Content/
Categories
‣ Installed the WP REST API Plugin
‣ Using Popper As My Theme
B U I L D T H E P L U G I N : S E T U P
B U I L D T H E P L U G I N : F I R S T S T E P S
B U I L D T H E P L U G I N : F I R S T S T E P S
B U I L D T H E P L U G I N : S E T U P
F U N C T I O N S
S O O N 2 5 % O F T H E W E B
W I L L H A V E A C C E S S T O T H E W O R D P R E S S R E S T A P I
A N D W I L L B E U S E D F O R I N T E R E S T I N G T H I N G S
R E S O U R C E S
http://wp-api.org/ Official Documentation
WordCamp Miami 2016
February 19-21 FIU College of Business
T H A N K Y O U
D A V I D B I S S E T
@dimensionmedia
david bisset
D A V I D B I S S E T. C O M
@ D I M E N S I O N M E D I A

More Related Content

What's hot

What's hot (20)

Il mio primo www introduzione
Il mio primo www introduzioneIl mio primo www introduzione
Il mio primo www introduzione
 
As Easy As Herding Squirrels: Managing Social Media on Your Campus #heweb15 #...
As Easy As Herding Squirrels: Managing Social Media on Your Campus #heweb15 #...As Easy As Herding Squirrels: Managing Social Media on Your Campus #heweb15 #...
As Easy As Herding Squirrels: Managing Social Media on Your Campus #heweb15 #...
 
Sacramento GovTech Social Academy Keynote
Sacramento GovTech Social Academy KeynoteSacramento GovTech Social Academy Keynote
Sacramento GovTech Social Academy Keynote
 
3rd Party Footprint @ Webrebels
3rd Party Footprint @ Webrebels3rd Party Footprint @ Webrebels
3rd Party Footprint @ Webrebels
 
300588828 guia-uam-cbs
300588828 guia-uam-cbs300588828 guia-uam-cbs
300588828 guia-uam-cbs
 
Scalable Link Building
Scalable Link BuildingScalable Link Building
Scalable Link Building
 
3rd party footprint - A PUBLISHER'S TAKE ON CONTROLLING 3RD PARTY SCRIPTS
3rd party footprint - A PUBLISHER'S TAKE ON CONTROLLING 3RD PARTY SCRIPTS3rd party footprint - A PUBLISHER'S TAKE ON CONTROLLING 3RD PARTY SCRIPTS
3rd party footprint - A PUBLISHER'S TAKE ON CONTROLLING 3RD PARTY SCRIPTS
 
Third Party Footprint: Evaluating the Performance of External Scripts
Third Party Footprint: Evaluating the Performance of External ScriptsThird Party Footprint: Evaluating the Performance of External Scripts
Third Party Footprint: Evaluating the Performance of External Scripts
 
Offline-first: Making your app resilient to network failures
Offline-first: Making your app resilient to network failuresOffline-first: Making your app resilient to network failures
Offline-first: Making your app resilient to network failures
 
Basic tutorial how to use google calendar
Basic tutorial how to use google calendarBasic tutorial how to use google calendar
Basic tutorial how to use google calendar
 
Ppi Claim Companies UK
Ppi Claim Companies UKPpi Claim Companies UK
Ppi Claim Companies UK
 
Be Mean to Your Code with Gauntlt and the Rugged Way // Velocity EU 2013 Work...
Be Mean to Your Code with Gauntlt and the Rugged Way // Velocity EU 2013 Work...Be Mean to Your Code with Gauntlt and the Rugged Way // Velocity EU 2013 Work...
Be Mean to Your Code with Gauntlt and the Rugged Way // Velocity EU 2013 Work...
 
Custom Software Development London
Custom Software Development LondonCustom Software Development London
Custom Software Development London
 
Helpwithmycaraccidentphiladelphia
HelpwithmycaraccidentphiladelphiaHelpwithmycaraccidentphiladelphia
Helpwithmycaraccidentphiladelphia
 
#casesmc As Easy As Herding Squirrels: Coordinating Social Media Across Your ...
#casesmc As Easy As Herding Squirrels: Coordinating Social Media Across Your ...#casesmc As Easy As Herding Squirrels: Coordinating Social Media Across Your ...
#casesmc As Easy As Herding Squirrels: Coordinating Social Media Across Your ...
 
How to use Google Calendar?
How to use Google Calendar?How to use Google Calendar?
How to use Google Calendar?
 
Greg Aiello
Greg AielloGreg Aiello
Greg Aiello
 
Chris' Mastery Journal Timeline
Chris' Mastery Journal TimelineChris' Mastery Journal Timeline
Chris' Mastery Journal Timeline
 
Death To Bullshit: Now With 80% More Bullshit!
Death To Bullshit: Now With 80% More Bullshit!Death To Bullshit: Now With 80% More Bullshit!
Death To Bullshit: Now With 80% More Bullshit!
 
再考!スマートフォンサイト定番UI 2015 05-14
再考!スマートフォンサイト定番UI 2015 05-14再考!スマートフォンサイト定番UI 2015 05-14
再考!スマートフォンサイト定番UI 2015 05-14
 

Viewers also liked

Extending SharePoint 2010 To Line of Business Integration A
Extending SharePoint 2010 To Line of Business Integration AExtending SharePoint 2010 To Line of Business Integration A
Extending SharePoint 2010 To Line of Business Integration A
ridwansassman
 
BCTLA Kelowna October 2010
BCTLA Kelowna October 2010BCTLA Kelowna October 2010
BCTLA Kelowna October 2010
branchjenn
 
Risk Management Lessons From The Current Crisis Ppt2003
Risk Management Lessons From The Current Crisis Ppt2003Risk Management Lessons From The Current Crisis Ppt2003
Risk Management Lessons From The Current Crisis Ppt2003
Barry Schachter
 
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
iCrossing
 

Viewers also liked (20)

Eyeful
EyefulEyeful
Eyeful
 
UI Design Trends
UI Design TrendsUI Design Trends
UI Design Trends
 
Managing your data: How to move from gathering data to processing and applyin...
Managing your data: How to move from gathering data to processing and applyin...Managing your data: How to move from gathering data to processing and applyin...
Managing your data: How to move from gathering data to processing and applyin...
 
Extending SharePoint 2010 To Line of Business Integration A
Extending SharePoint 2010 To Line of Business Integration AExtending SharePoint 2010 To Line of Business Integration A
Extending SharePoint 2010 To Line of Business Integration A
 
Utica shale presentation_cwc2011
Utica shale presentation_cwc2011Utica shale presentation_cwc2011
Utica shale presentation_cwc2011
 
Phosphorous in Grand Lake St. Marys
Phosphorous in Grand Lake St. MarysPhosphorous in Grand Lake St. Marys
Phosphorous in Grand Lake St. Marys
 
Your Big Data Opportunity
Your Big Data OpportunityYour Big Data Opportunity
Your Big Data Opportunity
 
SES SF 2010 - Real-Time Search - Rob Garner - iCrossing
SES SF 2010 - Real-Time Search - Rob Garner - iCrossingSES SF 2010 - Real-Time Search - Rob Garner - iCrossing
SES SF 2010 - Real-Time Search - Rob Garner - iCrossing
 
Acc0101
Acc0101Acc0101
Acc0101
 
Quant02
Quant02Quant02
Quant02
 
BCTLA Kelowna October 2010
BCTLA Kelowna October 2010BCTLA Kelowna October 2010
BCTLA Kelowna October 2010
 
Data driven vbhc e vd vinne
Data driven vbhc e vd vinneData driven vbhc e vd vinne
Data driven vbhc e vd vinne
 
Risk Management Lessons From The Current Crisis Ppt2003
Risk Management Lessons From The Current Crisis Ppt2003Risk Management Lessons From The Current Crisis Ppt2003
Risk Management Lessons From The Current Crisis Ppt2003
 
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
Logic Magic Attribution Modelling with Chuck Sharp November 2010 (iCrossing US)
 
Jarved Ehrenpreis
Jarved EhrenpreisJarved Ehrenpreis
Jarved Ehrenpreis
 
Bespeak - Ideeen genereren via Social Media
Bespeak - Ideeen genereren via Social MediaBespeak - Ideeen genereren via Social Media
Bespeak - Ideeen genereren via Social Media
 
IPA Search Council Presentation - By Nilhan Jayasinghe
IPA Search Council Presentation - By Nilhan JayasingheIPA Search Council Presentation - By Nilhan Jayasinghe
IPA Search Council Presentation - By Nilhan Jayasinghe
 
Building and Deploying a Global Intranet with Liferay
Building and Deploying a Global Intranet with LiferayBuilding and Deploying a Global Intranet with Liferay
Building and Deploying a Global Intranet with Liferay
 
Marketing Asset Center - Enabling Consistency & Productivity Across Sales & M...
Marketing Asset Center - Enabling Consistency & Productivity Across Sales & M...Marketing Asset Center - Enabling Consistency & Productivity Across Sales & M...
Marketing Asset Center - Enabling Consistency & Productivity Across Sales & M...
 
3big trends
3big trends3big trends
3big trends
 

Similar to SunShine PHP

Cloud Identity Deployed
Cloud Identity DeployedCloud Identity Deployed
Cloud Identity Deployed
Pablo Valarezo
 

Similar to SunShine PHP (20)

Cloud Identity Deployed
Cloud Identity DeployedCloud Identity Deployed
Cloud Identity Deployed
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
 
Azure: Finding Success Beyond Test/Dev
Azure: Finding Success Beyond Test/DevAzure: Finding Success Beyond Test/Dev
Azure: Finding Success Beyond Test/Dev
 
Web Development for Managers
Web Development for ManagersWeb Development for Managers
Web Development for Managers
 
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różniceGoogle Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
Google Assistant & Alexa - Asystenci głosowi: możliwości, podobieństwa, różnice
 
4 GDPR Hacks to Mitigate Breach Risks Post GDPR
4 GDPR Hacks to Mitigate Breach Risks Post GDPR4 GDPR Hacks to Mitigate Breach Risks Post GDPR
4 GDPR Hacks to Mitigate Breach Risks Post GDPR
 
Meteor - not just for rockstars
Meteor - not just for rockstarsMeteor - not just for rockstars
Meteor - not just for rockstars
 
Introducing the Unified Cloud - Sean Bruton
Introducing the Unified Cloud - Sean Bruton Introducing the Unified Cloud - Sean Bruton
Introducing the Unified Cloud - Sean Bruton
 
AWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 MelbourneAWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 Melbourne
 
AWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 SydneyAWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 Sydney
 
Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?
 
Understanding WordPress Filters and Actions
Understanding WordPress Filters and ActionsUnderstanding WordPress Filters and Actions
Understanding WordPress Filters and Actions
 
Nuno Job - what's next for software - ANDdigital tech summit
Nuno Job - what's next for software - ANDdigital tech summitNuno Job - what's next for software - ANDdigital tech summit
Nuno Job - what's next for software - ANDdigital tech summit
 
Simple Crossplatform REST-Service with .NET, Vagrant and Docker
Simple Crossplatform REST-Service with .NET, Vagrant and DockerSimple Crossplatform REST-Service with .NET, Vagrant and Docker
Simple Crossplatform REST-Service with .NET, Vagrant and Docker
 
AWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 BrisbaneAWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 Brisbane
 
Auckland AWS Seminar Series
Auckland AWS Seminar SeriesAuckland AWS Seminar Series
Auckland AWS Seminar Series
 
Automate iOS Deployment with Hamper and Schezhen
Automate iOS Deployment with Hamper and SchezhenAutomate iOS Deployment with Hamper and Schezhen
Automate iOS Deployment with Hamper and Schezhen
 
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWS
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWSPuppet Camp Sydney 2014 - Evolving Design Patterns in AWS
Puppet Camp Sydney 2014 - Evolving Design Patterns in AWS
 
Uberizing Government
Uberizing GovernmentUberizing Government
Uberizing Government
 
AWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 PerthAWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 Perth
 

More from David Bisset

WordCamp Tampa 2015
WordCamp Tampa 2015WordCamp Tampa 2015
WordCamp Tampa 2015
David Bisset
 
WPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPressWPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPress
David Bisset
 

More from David Bisset (20)

WordPress Theme Workshop: Part 0
WordPress Theme Workshop: Part 0WordPress Theme Workshop: Part 0
WordPress Theme Workshop: Part 0
 
WordPress Theme Workshop: Part 1
WordPress Theme Workshop: Part 1WordPress Theme Workshop: Part 1
WordPress Theme Workshop: Part 1
 
WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2WordPress Theme Workshop: Part 2
WordPress Theme Workshop: Part 2
 
WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3WordPress Theme Workshop: Part 3
WordPress Theme Workshop: Part 3
 
WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4WordPress Theme Workshop: Part 4
WordPress Theme Workshop: Part 4
 
WordPress Theme Workshop: Customizer
WordPress Theme Workshop: CustomizerWordPress Theme Workshop: Customizer
WordPress Theme Workshop: Customizer
 
WordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JSWordPress Theme Workshop: CSS/JS
WordPress Theme Workshop: CSS/JS
 
WordPress Theme Workshop: Internationalization
WordPress Theme Workshop: InternationalizationWordPress Theme Workshop: Internationalization
WordPress Theme Workshop: Internationalization
 
WordPress Theme Workshop: Misc
WordPress Theme Workshop: MiscWordPress Theme Workshop: Misc
WordPress Theme Workshop: Misc
 
WordPress Theme Workshop: Widgets
WordPress Theme Workshop: WidgetsWordPress Theme Workshop: Widgets
WordPress Theme Workshop: Widgets
 
WordPress Theme Workshop: Menus
WordPress Theme Workshop: MenusWordPress Theme Workshop: Menus
WordPress Theme Workshop: Menus
 
WordPress Theme Workshop: Sidebars
WordPress Theme Workshop: SidebarsWordPress Theme Workshop: Sidebars
WordPress Theme Workshop: Sidebars
 
WordPress Theme Workshop: Theme Setup
WordPress Theme Workshop: Theme SetupWordPress Theme Workshop: Theme Setup
WordPress Theme Workshop: Theme Setup
 
WordPress Meetup (Davie, FL) - Top 9 April 2016
WordPress Meetup (Davie, FL) - Top 9 April 2016WordPress Meetup (Davie, FL) - Top 9 April 2016
WordPress Meetup (Davie, FL) - Top 9 April 2016
 
WordCamp Tampa 2015
WordCamp Tampa 2015WordCamp Tampa 2015
WordCamp Tampa 2015
 
WPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPressWPSessions - Thinking Outside The Box With BuddyPress
WPSessions - Thinking Outside The Box With BuddyPress
 
Be a Part of Something Bigger: Get Involved with WordPress
Be a Part of Something Bigger: Get Involved with WordPressBe a Part of Something Bigger: Get Involved with WordPress
Be a Part of Something Bigger: Get Involved with WordPress
 
WordPress Meetup - Top 9 September 2015
WordPress Meetup - Top 9 September 2015WordPress Meetup - Top 9 September 2015
WordPress Meetup - Top 9 September 2015
 
WordPress Miami Meetup: Top 9 (August 2015)
WordPress Miami Meetup: Top 9 (August 2015)WordPress Miami Meetup: Top 9 (August 2015)
WordPress Miami Meetup: Top 9 (August 2015)
 
Getting Started With Grunt for WordPress Development
Getting Started With Grunt for WordPress DevelopmentGetting Started With Grunt for WordPress Development
Getting Started With Grunt for WordPress Development
 

SunShine PHP

  • 1. T H E W O R D P R E S S R E S T A P I D A V I D B I S S E T @dimensionmedia
  • 2. W H AT I S A R E S T A P I ?
  • 4. W H A T I S A R E S T A P I ? ‣ Separation Between Client and Server ‣ Stateless: No State, You Should Get Same Data From Same Requests ‣ Cacheable ‣ Layerable: Load-Balancing, etc. ‣ Uniform: REST APIs typically tell you how to access the data. ‣ Flexible: Doesn’t Matter Where Server/Client Area, Or What They Are ‣ Simple: Uses Standard/Established Methods
  • 5. C R U D A N D H T T P M E T H O D S ‣ CREATE -> POST ‣ READ -> GET ‣ UPDATE -> PUT ‣ DELETE -> DELETE
  • 6. W H AT I S T H E W P R E S T A P I ?
  • 7. W O R D P R E S S + R E S T A P I = A W E S O M E S A U C E
  • 8. R E Q U I R E M E N T S ‣ WordPress 4.4 ‣ WP REST API Plugin 2.0
  • 9. L E T ’ S D I V E I N !
  • 10. P O S T M A N https://www.getpostman.com/ Allows us to build and send requests to our API and also process and handle responses. A really great tool for working with any type of REST API, not just the WordPress API.
  • 12.
  • 14.
  • 15.
  • 16.
  • 18.
  • 20.
  • 21. U S I N G C U R L & W P _ H T T P
  • 23. $curl = curl_init(); curl_setopt ($curl, CURLOPT_URL, 
 "http://local.wordpress.dev/wp-json/wp/v2/posts"); $json = curl_exec ($curl); curl_close ($curl); $data = json_decode($json); var_dump($data);
  • 24. $json = wp_remote_get
 ( 'http://local.wordpress.dev/wp-json/wp/v2/posts' ); $return = json_decode( $json['body'] ); var_dump($return);
  • 25. W O R K I N G W I T H P O S T S
  • 28.
  • 29.
  • 30.
  • 31. F I LT E R I N G P O S T S
  • 33.
  • 36. PA G E S
  • 38. P O S T M E TA
  • 39.
  • 40.
  • 41.
  • 42. P O S T M E TA ( F I LT E R I N G )
  • 43.
  • 45.
  • 46. A U T H E N T I C AT I O N
  • 47. T H E R E A R E 4 B A S I C T Y P E S O F A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W: ‣ Basic Authentication – via a plugin ‣ Cookie Authentication – out of the box ‣ Oauth2 Authentication – via a plugin (third party) ‣ Oauth1 Authentication – via a plugin
  • 48. T H E R E A R E 4 B A S I C T Y P E S O F A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W: ‣ Basic Authentication – via a plugin ‣ Cookie Authentication – out of the box ‣ Oauth2 Authentication – via a plugin (third party) ‣ Oauth1 Authentication – via a plugin
  • 49.
  • 50. B A S I C - A U T H https://github.com/WP-API/Basic-Auth
  • 51. TA D A ! B A S I C A U T H G E T S Y O U T H E S A M E A C C E S S / R O L E S A S Y O U R W P U S E R
  • 52. F O R E X A M P L E , I F Y O U H A V E A D M I N A C C E S S Y O U C A N S E E A L L U S E R S
  • 53. T H E R E A R E 4 B A S I C T Y P E S O F A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W: ‣ Basic Authentication – via a plugin ‣ Cookie Authentication – out of the box ‣ Oauth2 Authentication – via a plugin (third party) ‣ Oauth1 Authentication – via a plugin
  • 54. T H E R E A R E 4 B A S I C T Y P E S O F A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W: ‣ Basic Authentication – via a plugin ‣ Cookie Authentication – out of the box ‣ Oauth2 Authentication – via a plugin (third party) ‣ Oauth1 Authentication – via a plugin
  • 55. T H E R E A R E 4 B A S I C T Y P E S O F A U T H E N T I C A T I O N A VA I L A B L E F O R U S E R I G H T N O W: ‣ Basic Authentication – via a plugin ‣ Cookie Authentication – out of the box ‣ Oauth2 Authentication – via a plugin (third party) ‣ Oauth1 Authentication – via a plugin
  • 56. D I G G I N G I N T O T H E A P I : C R E AT I N G A N E W P O S T
  • 57.
  • 58.
  • 59. D I G G I N G I N T O T H E A P I : A D D N I N G & U P D AT I N G P O S T M E TA T O A P O S T
  • 60.
  • 61. D I G G I N G I N T O T H E A P I : D E L E T I N G A P O S T
  • 62.
  • 63. W H Y T H I S I S C O O L ‣ “Reverse Mullet”: Business in back, party in the front ‣ You don’t have to write PHP (write what you want) ‣ WordPress Can Now Power Native Mobile Applications ‣ Desktop Applications Possible ‣ More engaging user experience ‣ Offline: Control over failed connections, etc.
  • 64. T H E M E S W I T H T H E W O R D P R E S S R E S T A P I
  • 65.
  • 66. B U I L D I N G A P L U G I N U S I N G W P - A P I A N D A J A X
  • 67. W H AT W E A R E B U I L D I N G
  • 68. T H I N K A B O U T T H E A P I R E Q U E S T U R L
  • 69. ‣ New WordPress 4.4 Install ‣ Used FakerPress To Add Random Content/ Categories ‣ Installed the WP REST API Plugin ‣ Using Popper As My Theme B U I L D T H E P L U G I N : S E T U P
  • 70. B U I L D T H E P L U G I N : F I R S T S T E P S
  • 71. B U I L D T H E P L U G I N : F I R S T S T E P S
  • 72. B U I L D T H E P L U G I N : S E T U P F U N C T I O N S
  • 73.
  • 74. S O O N 2 5 % O F T H E W E B W I L L H A V E A C C E S S T O T H E W O R D P R E S S R E S T A P I A N D W I L L B E U S E D F O R I N T E R E S T I N G T H I N G S
  • 75. R E S O U R C E S http://wp-api.org/ Official Documentation
  • 76. WordCamp Miami 2016 February 19-21 FIU College of Business
  • 77. T H A N K Y O U D A V I D B I S S E T @dimensionmedia
  • 78. david bisset D A V I D B I S S E T. C O M @ D I M E N S I O N M E D I A