SlideShare a Scribd company logo
1 of 35
Download to read offline
http://jpwp.me/2y 
Using The New 
WordPress REST API 
Josh Pollock - JoshPress.net - @Josh412
Hello World.json
The Universal Connector 
http://xkcd.com/1406/
The WordPress REST API 
A new way to consume and modify data from 
WordPress, using a standards-compliant JSON 
RESTful API--from within WordPress or from 
another application.
Plugin, Feature 
or What? 
Feature as a plugin...
The WordPress REST API 
● Currently under development, totally 
functional. In WordPress core *soon*. 
● For now, its a plugin: 
● Download: 
○ https://wordpress.org/plugins/json-rest-api/ 
● Docs 
○ http://wp-api.org
This Is A Big 
Deal 
WordPress runs over 20% of the internet.
It's Very Easy To 
Use 
Kind of like WordPress:)
Except 
You do not need to know much about 
WordPress To Use It.
Capabilities 
Almost all front-end capabilities of WordPress. 
Super extensible, just like WordPress. 
Adding Custom Routes/ Endpoints Is Easy.
https://speakerdeck.com/rmccue/wcmke2014
Not Yet... 
What About 
Admin?
Authentication 
Follows WordPress' Existing User Capabilities 
● Basic Auth 
○ Testing Only 
● oAuth1 
○ Most secure 
● Public/Secret Key Pair 
○ OK, over HTTPS
Why This Is A Big Deal 
● Quality WordPress developers are in 
demand and expensive. 
● With a little prep work, any front-end 
developer can work on your WordPress, 
REST API-Powered Site.
Why This Is A Big Deal 
Decouple the front-end: 
● Front-end can be on a different server. 
● Front-end can be in a different language.
What Can You Use It For? 
● Make your existing site more interactive 
● Use WordPress as the backend for an app 
● Process forms 
● Integrate your WordPress site with other 
platforms 
● Integrate other platforms 
● Make cool plugins
Not Just For 
Blogs! 
Neither Is WordPress
Pods- Power Tools For WordPress as a CMS.
Custom Content Types 
● Custom Post Types 
● Custom Taxonomies 
● Pods Advanced Content Types 
○ Separate tables
Pods Has A JSON API 
Adds routes to the JSON API For Custom 
Content Types & Fields 
https://github.com/pods-framework/pods-json-api
What Have I Made With It? 
● JP-REST-API-Client - A simple client for creating and updating posts via the WordPress 
REST API via the WordPress HTTP API. 
● Pods JSON API - I added new routes, endpoints and documentation to the add-on to the API 
for Pods. 
● Pods Deploy - A tool for automating the process of moving Pods configurations between 
sites. 
● JP-Tax-Query - A custom endpoint for making tax queries via the REST API. 
● A basic front-end post editor, detailed in this Torque article.
And: Josie, A Starter Single Page App
Routing Via Node/ Express 
var express = require('express'); 
var path = require('path'); 
var server = express(); 
server.use(express.static(__dirname + '/public')); 
server.use(express.static(path.join(__dirname, 'public'))); 
server.get('*', function(req, res){ 
res.sendFile(__dirname + '/public/index.html'); 
}); 
var port = 10001; 
server.listen(port, function() { 
console.log('server listening on port ' + port); 
}); 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-routing-via-node-express-js
Demo Time 
http://jpwp.me/app
Advantages 
● Fast 
● Simple 
● Templating in PHP is less than ideal... 
● Simple code, any front-end dev can work 
with
Disadvantages 
● Some front-end plugins will not work. 
● Two systems, two points of failure, etc...
Basic Code Patterns 
● All examples in JavaScript 
● Will Work In WordPress or Outside of it 
● Skipping PHP Today 
○ https://github.com/Shelob9/jp-wp-api-rest-api-client
Get A Post: AJAX 
$.ajax({ 
type: 'GET', 
url: 'http://example.com/wp-json/posts', 
dataType: 'json', 
success: function(posts){ 
$.each( posts, function(index, post) { 
//do something with each post 
}); 
}, 
error: function(error){ 
console.log(error); 
} 
}); 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-post-via-wp-api-js
Get Posts: AJAX 
$.ajax({ 
type: 'GET', 
url: 'http://example.com/wp-json/posts', 
dataType: 'json', 
success: function(posts){ 
$.each( posts, function(index, post) { 
//do something with each post 
}); 
}, 
error: function(error){ 
console.log(error); 
} 
}); 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-posts-via-wp-api-js
Parse With Handlebars 
$.ajax({ 
type: 'GET', 
url: 'http://example.com/wp-json/posts', 
dataType: 'json', 
success: function(posts){ 
$.each( posts, function(index, post) { 
var source = $('#posts').html(); 
var template = Handlebars.compile(source); 
var html = template(post); 
}); 
}, 
error: function(error){ 
console.log(error); 
} 
}); 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-posts-via-wp-api-handlebars-js
Get All Posts With Tag 
$( '[rel="tag"]' ).click( function( event ) { 
event.preventDefault(); 
var href = this.href; 
if ( href.substr(-1) == '/') { 
href = href.substr( 0, href.length - 1 ); 
} 
var slug = href.split('/').pop(); 
$.ajax({ 
type: 'GET', 
cache: true, 
url: rootURL + '/posts?filter[tag]=' + slug, 
dataType: 'json', 
success: function(posts) { 
var html = '<ul>'; 
$.each( posts, function(index, post ) { 
html += '<li><a href="' + post.link + '">' + post.title + '</a></li>'; 
}); 
html += '</ul>'; 
$('article').append( html); 
} 
}); 
}); 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-all-posts-with-tag-js
Backbone Based JS Client 
https://github.com/WP-API/client-js
JS Client Example: Users 
function loadUsers ( users, container, templateID ) { 
$.each(users, function( i, val ) { 
var user = new wp.api.models.User( { ID: val } ); 
user.fetch().done(function () { 
loadUser( user, container, templateID ); 
}); 
}); 
} 
function loadUser( user, container, templateID ) { 
var name = user.attributes.name; 
var avatar = user.attributes.avatar; 
var ID = user.attributes.ID; 
var source = $( templateID ).html(); 
var data = { 
name: name, 
avatar: avatar, 
ID: ID 
}; 
var template = Handlebars.compile( source ); 
var html = template( data ); 
$( container ).append( html ); 
} 
https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-users-js
Learn More 
Read My Articles In Torque 
Come To The Tallahassee WordPress Meetup: 
Turning WordPress Sites Into Web & Mobile 
Apps Thursday, November 13, 2014 @ Domi
Josh@JoshPress.net - @Josh412 
Questions? 
Slides and info: http://jpwp.me/2y

More Related Content

What's hot

Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and othersYusuke Wada
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functionspodsframework
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON APIpodsframework
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutVic Metcalfe
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 
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
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To LampAmzad Hossain
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsAbdul Malik Ikhsan
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
AngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkAngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkBackand Cohen
 

What's hot (20)

RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
 
Undercover Pods / WP Functions
Undercover Pods / WP FunctionsUndercover Pods / WP Functions
Undercover Pods / WP Functions
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON API
 
Slim RedBeanPHP and Knockout
Slim RedBeanPHP and KnockoutSlim RedBeanPHP and Knockout
Slim RedBeanPHP and Knockout
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Zend framework
Zend frameworkZend framework
Zend framework
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
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
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Phinx talk
Phinx talkPhinx talk
Phinx talk
 
4.2 PHP Function
4.2 PHP Function4.2 PHP Function
4.2 PHP Function
 
Mojo as a_client
Mojo as a_clientMojo as a_client
Mojo as a_client
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
Codeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework ComponentsCodeigniter : Using Third Party Components - Zend Framework Components
Codeigniter : Using Third Party Components - Zend Framework Components
 
Rest api with Python
Rest api with PythonRest api with Python
Rest api with Python
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
AngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro FrameworkAngularJS with Slim PHP Micro Framework
AngularJS with Slim PHP Micro Framework
 

Viewers also liked

Composer による依存管理 と Packagist によるライブラリの公開
Composer による依存管理 と Packagist によるライブラリの公開Composer による依存管理 と Packagist によるライブラリの公開
Composer による依存管理 と Packagist によるライブラリの公開Shogo Kawahara
 
Agile Data Rationalization for Operational Intelligence
Agile Data Rationalization for Operational IntelligenceAgile Data Rationalization for Operational Intelligence
Agile Data Rationalization for Operational IntelligenceInside Analysis
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesPantheon
 
Photography for Websites
Photography for WebsitesPhotography for Websites
Photography for WebsitesScott Fisk
 
Typography: The Backbone of Your Website
Typography: The Backbone of Your WebsiteTypography: The Backbone of Your Website
Typography: The Backbone of Your WebsiteAlison Chandler
 
新標準PSRに学ぶきれいなPHP
新標準PSRに学ぶきれいなPHP新標準PSRに学ぶきれいなPHP
新標準PSRに学ぶきれいなPHPYusuke Ando
 

Viewers also liked (6)

Composer による依存管理 と Packagist によるライブラリの公開
Composer による依存管理 と Packagist によるライブラリの公開Composer による依存管理 と Packagist によるライブラリの公開
Composer による依存管理 と Packagist によるライブラリの公開
 
Agile Data Rationalization for Operational Intelligence
Agile Data Rationalization for Operational IntelligenceAgile Data Rationalization for Operational Intelligence
Agile Data Rationalization for Operational Intelligence
 
WordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use CasesWordPress REST API: Expert Advice & Practical Use Cases
WordPress REST API: Expert Advice & Practical Use Cases
 
Photography for Websites
Photography for WebsitesPhotography for Websites
Photography for Websites
 
Typography: The Backbone of Your Website
Typography: The Backbone of Your WebsiteTypography: The Backbone of Your Website
Typography: The Backbone of Your Website
 
新標準PSRに学ぶきれいなPHP
新標準PSRに学ぶきれいなPHP新標準PSRに学ぶきれいなPHP
新標準PSRに学ぶきれいなPHP
 

Similar to Using WordPress REST API Build Apps

WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!Evan Mullins
 
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017ylefebvre
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.pptWalaSidhom1
 
WordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTOWordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTORoy Sivan
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScriptOleg Podsechin
 
Single Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APISingle Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APITejaswini Deshpande
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto PresentationRoy Sivan
 
Nodejs first class
Nodejs first classNodejs first class
Nodejs first classFin Chen
 
Pywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersPywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersJorge Mendes
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.jsAyush Mishra
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...King Foo
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTYWilliam Chong
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Make the Web 3D
Make the Web 3DMake the Web 3D
Make the Web 3DAdam Nagy
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIsmdawaffe
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 

Similar to Using WordPress REST API Build Apps (20)

WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything!
 
Plugin development demystified 2017
Plugin development demystified 2017Plugin development demystified 2017
Plugin development demystified 2017
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 
NodeJS
NodeJSNodeJS
NodeJS
 
WordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTOWordPress and Client Side Web Applications WCTO
WordPress and Client Side Web Applications WCTO
 
The future of server side JavaScript
The future of server side JavaScriptThe future of server side JavaScript
The future of server side JavaScript
 
Single Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APISingle Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST API
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
 
Nodejs first class
Nodejs first classNodejs first class
Nodejs first class
 
Pywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developersPywps a tutorial for beginners and developers
Pywps a tutorial for beginners and developers
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.js
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Make the Web 3D
Make the Web 3DMake the Web 3D
Make the Web 3D
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 

More from Caldera Labs

Slightly Advanced Topics in Gutenberg Development
Slightly Advanced Topics in Gutenberg Development Slightly Advanced Topics in Gutenberg Development
Slightly Advanced Topics in Gutenberg Development Caldera Labs
 
Financial Forecasting For WordPress Businesses
Financial Forecasting For WordPress BusinessesFinancial Forecasting For WordPress Businesses
Financial Forecasting For WordPress BusinessesCaldera Labs
 
Five Attitudes Stopping You From Building Accessible Wordpress Websites
Five Attitudes Stopping You From Building Accessible Wordpress WebsitesFive Attitudes Stopping You From Building Accessible Wordpress Websites
Five Attitudes Stopping You From Building Accessible Wordpress WebsitesCaldera Labs
 
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
Our Hybrid Future: WordPress As Part of the Stack #WCNYCOur Hybrid Future: WordPress As Part of the Stack #WCNYC
Our Hybrid Future: WordPress As Part of the Stack #WCNYCCaldera Labs
 
Our Hybrid Future: WordPress As Part of the Stack
Our Hybrid Future: WordPress As Part of the StackOur Hybrid Future: WordPress As Part of the Stack
Our Hybrid Future: WordPress As Part of the StackCaldera Labs
 
Introduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST APIIntroduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST APICaldera Labs
 
Introduction to plugin development
Introduction to plugin developmentIntroduction to plugin development
Introduction to plugin developmentCaldera Labs
 
It all starts with a story
It all starts with a storyIt all starts with a story
It all starts with a storyCaldera Labs
 
Five events in the life of every WordPress request you should know
Five events in the life of every WordPress request you should knowFive events in the life of every WordPress request you should know
Five events in the life of every WordPress request you should knowCaldera Labs
 
WPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin DevelopmentWPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin DevelopmentCaldera Labs
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPressCaldera Labs
 
Josh Pollock #wcatl using composer to increase your word press development po...
Josh Pollock #wcatl using composer to increase your word press development po...Josh Pollock #wcatl using composer to increase your word press development po...
Josh Pollock #wcatl using composer to increase your word press development po...Caldera Labs
 
Content Marketing With WordPress -- Tallahassee WordPress Meetup
Content Marketing With WordPress -- Tallahassee WordPress MeetupContent Marketing With WordPress -- Tallahassee WordPress Meetup
Content Marketing With WordPress -- Tallahassee WordPress MeetupCaldera Labs
 
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...Caldera Labs
 
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile AppsWordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile AppsCaldera Labs
 

More from Caldera Labs (16)

Slightly Advanced Topics in Gutenberg Development
Slightly Advanced Topics in Gutenberg Development Slightly Advanced Topics in Gutenberg Development
Slightly Advanced Topics in Gutenberg Development
 
Financial Forecasting For WordPress Businesses
Financial Forecasting For WordPress BusinessesFinancial Forecasting For WordPress Businesses
Financial Forecasting For WordPress Businesses
 
Five Attitudes Stopping You From Building Accessible Wordpress Websites
Five Attitudes Stopping You From Building Accessible Wordpress WebsitesFive Attitudes Stopping You From Building Accessible Wordpress Websites
Five Attitudes Stopping You From Building Accessible Wordpress Websites
 
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
Our Hybrid Future: WordPress As Part of the Stack #WCNYCOur Hybrid Future: WordPress As Part of the Stack #WCNYC
Our Hybrid Future: WordPress As Part of the Stack #WCNYC
 
Our Hybrid Future: WordPress As Part of the Stack
Our Hybrid Future: WordPress As Part of the StackOur Hybrid Future: WordPress As Part of the Stack
Our Hybrid Future: WordPress As Part of the Stack
 
Introduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST APIIntroduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST API
 
Introduction to plugin development
Introduction to plugin developmentIntroduction to plugin development
Introduction to plugin development
 
It all starts with a story
It all starts with a storyIt all starts with a story
It all starts with a story
 
A/B Testing FTW
A/B Testing FTWA/B Testing FTW
A/B Testing FTW
 
Five events in the life of every WordPress request you should know
Five events in the life of every WordPress request you should knowFive events in the life of every WordPress request you should know
Five events in the life of every WordPress request you should know
 
WPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin DevelopmentWPSessions Composer for WordPress Plugin Development
WPSessions Composer for WordPress Plugin Development
 
Introduction to AJAX In WordPress
Introduction to AJAX In WordPressIntroduction to AJAX In WordPress
Introduction to AJAX In WordPress
 
Josh Pollock #wcatl using composer to increase your word press development po...
Josh Pollock #wcatl using composer to increase your word press development po...Josh Pollock #wcatl using composer to increase your word press development po...
Josh Pollock #wcatl using composer to increase your word press development po...
 
Content Marketing With WordPress -- Tallahassee WordPress Meetup
Content Marketing With WordPress -- Tallahassee WordPress MeetupContent Marketing With WordPress -- Tallahassee WordPress Meetup
Content Marketing With WordPress -- Tallahassee WordPress Meetup
 
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
Writing About WordPress: Helping Yourself, by Helping Others -- WordCamp Orl...
 
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile AppsWordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
WordPress Tallahassee Meetup: Turning WordPress Sites Into Web & Mobile Apps
 

Recently uploaded

VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneCall girls in Ahmedabad High profile
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Rohini 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service PuneVIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
VIP Call Girls Pune Madhuri 8617697112 Independent Escort Service Pune
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 

Using WordPress REST API Build Apps

  • 1. http://jpwp.me/2y Using The New WordPress REST API Josh Pollock - JoshPress.net - @Josh412
  • 3. The Universal Connector http://xkcd.com/1406/
  • 4. The WordPress REST API A new way to consume and modify data from WordPress, using a standards-compliant JSON RESTful API--from within WordPress or from another application.
  • 5. Plugin, Feature or What? Feature as a plugin...
  • 6. The WordPress REST API ● Currently under development, totally functional. In WordPress core *soon*. ● For now, its a plugin: ● Download: ○ https://wordpress.org/plugins/json-rest-api/ ● Docs ○ http://wp-api.org
  • 7. This Is A Big Deal WordPress runs over 20% of the internet.
  • 8. It's Very Easy To Use Kind of like WordPress:)
  • 9. Except You do not need to know much about WordPress To Use It.
  • 10. Capabilities Almost all front-end capabilities of WordPress. Super extensible, just like WordPress. Adding Custom Routes/ Endpoints Is Easy.
  • 12. Not Yet... What About Admin?
  • 13. Authentication Follows WordPress' Existing User Capabilities ● Basic Auth ○ Testing Only ● oAuth1 ○ Most secure ● Public/Secret Key Pair ○ OK, over HTTPS
  • 14. Why This Is A Big Deal ● Quality WordPress developers are in demand and expensive. ● With a little prep work, any front-end developer can work on your WordPress, REST API-Powered Site.
  • 15. Why This Is A Big Deal Decouple the front-end: ● Front-end can be on a different server. ● Front-end can be in a different language.
  • 16. What Can You Use It For? ● Make your existing site more interactive ● Use WordPress as the backend for an app ● Process forms ● Integrate your WordPress site with other platforms ● Integrate other platforms ● Make cool plugins
  • 17. Not Just For Blogs! Neither Is WordPress
  • 18. Pods- Power Tools For WordPress as a CMS.
  • 19. Custom Content Types ● Custom Post Types ● Custom Taxonomies ● Pods Advanced Content Types ○ Separate tables
  • 20. Pods Has A JSON API Adds routes to the JSON API For Custom Content Types & Fields https://github.com/pods-framework/pods-json-api
  • 21. What Have I Made With It? ● JP-REST-API-Client - A simple client for creating and updating posts via the WordPress REST API via the WordPress HTTP API. ● Pods JSON API - I added new routes, endpoints and documentation to the add-on to the API for Pods. ● Pods Deploy - A tool for automating the process of moving Pods configurations between sites. ● JP-Tax-Query - A custom endpoint for making tax queries via the REST API. ● A basic front-end post editor, detailed in this Torque article.
  • 22. And: Josie, A Starter Single Page App
  • 23. Routing Via Node/ Express var express = require('express'); var path = require('path'); var server = express(); server.use(express.static(__dirname + '/public')); server.use(express.static(path.join(__dirname, 'public'))); server.get('*', function(req, res){ res.sendFile(__dirname + '/public/index.html'); }); var port = 10001; server.listen(port, function() { console.log('server listening on port ' + port); }); https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-routing-via-node-express-js
  • 25. Advantages ● Fast ● Simple ● Templating in PHP is less than ideal... ● Simple code, any front-end dev can work with
  • 26. Disadvantages ● Some front-end plugins will not work. ● Two systems, two points of failure, etc...
  • 27. Basic Code Patterns ● All examples in JavaScript ● Will Work In WordPress or Outside of it ● Skipping PHP Today ○ https://github.com/Shelob9/jp-wp-api-rest-api-client
  • 28. Get A Post: AJAX $.ajax({ type: 'GET', url: 'http://example.com/wp-json/posts', dataType: 'json', success: function(posts){ $.each( posts, function(index, post) { //do something with each post }); }, error: function(error){ console.log(error); } }); https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-post-via-wp-api-js
  • 29. Get Posts: AJAX $.ajax({ type: 'GET', url: 'http://example.com/wp-json/posts', dataType: 'json', success: function(posts){ $.each( posts, function(index, post) { //do something with each post }); }, error: function(error){ console.log(error); } }); https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-posts-via-wp-api-js
  • 30. Parse With Handlebars $.ajax({ type: 'GET', url: 'http://example.com/wp-json/posts', dataType: 'json', success: function(posts){ $.each( posts, function(index, post) { var source = $('#posts').html(); var template = Handlebars.compile(source); var html = template(post); }); }, error: function(error){ console.log(error); } }); https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-get-posts-via-wp-api-handlebars-js
  • 31. Get All Posts With Tag $( '[rel="tag"]' ).click( function( event ) { event.preventDefault(); var href = this.href; if ( href.substr(-1) == '/') { href = href.substr( 0, href.length - 1 ); } var slug = href.split('/').pop(); $.ajax({ type: 'GET', cache: true, url: rootURL + '/posts?filter[tag]=' + slug, dataType: 'json', success: function(posts) { var html = '<ul>'; $.each( posts, function(index, post ) { html += '<li><a href="' + post.link + '">' + post.title + '</a></li>'; }); html += '</ul>'; $('article').append( html); } }); }); https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-all-posts-with-tag-js
  • 32. Backbone Based JS Client https://github.com/WP-API/client-js
  • 33. JS Client Example: Users function loadUsers ( users, container, templateID ) { $.each(users, function( i, val ) { var user = new wp.api.models.User( { ID: val } ); user.fetch().done(function () { loadUser( user, container, templateID ); }); }); } function loadUser( user, container, templateID ) { var name = user.attributes.name; var avatar = user.attributes.avatar; var ID = user.attributes.ID; var source = $( templateID ).html(); var data = { name: name, avatar: avatar, ID: ID }; var template = Handlebars.compile( source ); var html = template( data ); $( container ).append( html ); } https://gist.github.com/Shelob9/460ed491f3a2b2773dac#file-users-js
  • 34. Learn More Read My Articles In Torque Come To The Tallahassee WordPress Meetup: Turning WordPress Sites Into Web & Mobile Apps Thursday, November 13, 2014 @ Domi
  • 35. Josh@JoshPress.net - @Josh412 Questions? Slides and info: http://jpwp.me/2y