WP json api

Paul Bearne
Paul BearneFreelance Senior WordPress Full Stack Developer at Paul & Gina Bearne
WP JSON API
A DEEP CODE DIVE INTO HOW TO EXTEND IT
Slides @ http://www.slideshare.net/pbearne
Code@ https://bitbucket.org/bearne/api_demo/src
Paul Bearne @pbearne
Freelance Senior Full Stack WordPress Developer,
Core contribs in WordPress versions 3.9, 4.0, 4.2, 4.4, 4.5 and 4.6
Bearne.ca
Plugin author of:
Author Avatars List ( https://wordpress.org/plugins/author-avatars/ )
WP Bullhorn Job Listing ( https://wordpress.org/plugins/bh-staffing-job-listing-and-cv-upload-for-wp/ )
WP Vote (https:// wp-vote.com )
Real-time Publishing for WordPress
Livepress.com
eLearning Solutions Powered by WordPress
UncannyOwl.com
#1 Outsourcing Service For WordPress
Codeable.io
$10 credit : https://codeable.io?coupon_code=WSQWI1
digital production and design agency
jam3.com
WP JSON API
TURNING WORDPRESS INTO AN APPLICATION FRAMEWORK
What will we cover today?
A bit on why it matters
How to install/setup
Where are the docs
What you get out of the box
How to mess with it
By the end, you should be able to:
Expose a custom post type in the API
View the output of the API
Send data to the API
Save data sent to the API
Return custom data to an API call
Why does it matter?
JSON data for free
Enables advance apps
Standardizes an AJAX endpoint
It makes WordPress an application framework
Performance – 15%+ faster
https://deliciousbrains.com/comparing-wordpress-rest-api-performance-admin-ajax-php
Install?
WP version 4.6 +
Install the plugin
Check permalinks are set
Test by loading /wp-json/wp/v2/posts
Install Postman and JSONview chrome tools
JSONView chrome extension
https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
Postman chrome extension
https://chrome.google.com/webstore/detail/postman-rest-client-packa/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
Where to get it (V2)?
http://v2.wp-api.org/
https://wordpress.org/plugins/rest-api/
Note: V1 docs are here http://wp-api.org/index-deprecated.html
What you get out of the box
http://local.wordpress.dev/wp-json/wp/v2
Note: V1 docs are here http://wp-api.org/index-deprecated.html
Code Read Through
THIS CODE STARTED USING V1, BUT I HAVE ADDED V2 CALLS.
THIS JUST ONE APPROACH.
Questions?
Hire Me...
PAUL@BEARNE.COM
Slides@ http://www.slideshare.net/pbearne
Email: pbearne@gmail.com
1 of 20

Recommended

WordPress Plug-ins by
WordPress Plug-insWordPress Plug-ins
WordPress Plug-insOveractDev Technology Partners
302 views3 slides
WordPress Plugin - Chameleon by
WordPress Plugin - ChameleonWordPress Plugin - Chameleon
WordPress Plugin - ChameleonFahad Mahmood
146 views8 slides
Publshing to amazon kindle and apple i bookstore by
Publshing to amazon kindle and apple i bookstorePublshing to amazon kindle and apple i bookstore
Publshing to amazon kindle and apple i bookstoreMatt Sullivan
844 views36 slides
Lava con 2011 amazon and apple publishing workshop2 by
Lava con 2011 amazon and apple publishing workshop2Lava con 2011 amazon and apple publishing workshop2
Lava con 2011 amazon and apple publishing workshop2Matt Sullivan
3.1K views34 slides
Familiar Tools, New Possibilities: Leveraging the Power of the Adobe Web Pub... by
Familiar Tools, New Possibilities:  Leveraging the Power of the Adobe Web Pub...Familiar Tools, New Possibilities:  Leveraging the Power of the Adobe Web Pub...
Familiar Tools, New Possibilities: Leveraging the Power of the Adobe Web Pub...John Hartley
1.1K views29 slides
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. by
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem.
SharePoint Framework -The future of SharePoint/ Office 365 developer ecosystem. Kushan Lahiru Perera
919 views39 slides

More Related Content

What's hot

DevOps + MongoDB Realm Serverless Functions = 🤩 by
DevOps + MongoDB Realm Serverless Functions = 🤩DevOps + MongoDB Realm Serverless Functions = 🤩
DevOps + MongoDB Realm Serverless Functions = 🤩Lauren Hayward Schaefer
376 views56 slides
Wordpress as a Back Office for Mobile Applications by
Wordpress as a Back Office for Mobile ApplicationsWordpress as a Back Office for Mobile Applications
Wordpress as a Back Office for Mobile ApplicationsBenjamin LUPU
2.8K views88 slides
Building Chrome Extensions For Salesforce by
Building Chrome Extensions  For SalesforceBuilding Chrome Extensions  For Salesforce
Building Chrome Extensions For SalesforceAbhinav Gupta
1.6K views15 slides
Adobe AIR. NativeProcess. FFMPEG. Awesome. by
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.Joseph Labrecque
9.9K views41 slides
Internship Presentation 1 Web Developer by
Internship Presentation 1 Web DeveloperInternship Presentation 1 Web Developer
Internship Presentation 1 Web DeveloperHemant Sarthak
24.2K views16 slides
Introduction to polymer project by
Introduction to polymer projectIntroduction to polymer project
Introduction to polymer projectChristoforus Surjoputro
526 views45 slides

What's hot(20)

Wordpress as a Back Office for Mobile Applications by Benjamin LUPU
Wordpress as a Back Office for Mobile ApplicationsWordpress as a Back Office for Mobile Applications
Wordpress as a Back Office for Mobile Applications
Benjamin LUPU2.8K views
Building Chrome Extensions For Salesforce by Abhinav Gupta
Building Chrome Extensions  For SalesforceBuilding Chrome Extensions  For Salesforce
Building Chrome Extensions For Salesforce
Abhinav Gupta1.6K views
Adobe AIR. NativeProcess. FFMPEG. Awesome. by Joseph Labrecque
Adobe AIR. NativeProcess. FFMPEG. Awesome.Adobe AIR. NativeProcess. FFMPEG. Awesome.
Adobe AIR. NativeProcess. FFMPEG. Awesome.
Joseph Labrecque9.9K views
Internship Presentation 1 Web Developer by Hemant Sarthak
Internship Presentation 1 Web DeveloperInternship Presentation 1 Web Developer
Internship Presentation 1 Web Developer
Hemant Sarthak24.2K views
Making your documentation more social by Matt Sullivan
Making your documentation more socialMaking your documentation more social
Making your documentation more social
Matt Sullivan487 views
Charlie Cheever Facebook Developer Garage Uganda by Leila Janah
Charlie Cheever Facebook Developer Garage UgandaCharlie Cheever Facebook Developer Garage Uganda
Charlie Cheever Facebook Developer Garage Uganda
Leila Janah1.4K views
What a Back-end Java Developer Doesn't Know About the Modern Web Stack-final by Rikard Thulin
What a Back-end Java Developer Doesn't Know About the Modern Web Stack-finalWhat a Back-end Java Developer Doesn't Know About the Modern Web Stack-final
What a Back-end Java Developer Doesn't Know About the Modern Web Stack-final
Rikard Thulin1.8K views
Web Application Development Process presented by @Cygnismedia by Clark Davidson
Web Application Development Process presented by @CygnismediaWeb Application Development Process presented by @Cygnismedia
Web Application Development Process presented by @Cygnismedia
Clark Davidson9.1K views
All you need to know about WordPress 4.7 by Amy Brown
All you need to know about WordPress 4.7All you need to know about WordPress 4.7
All you need to know about WordPress 4.7
Amy Brown515 views
Writing Your First Plugin by George Ornbo
Writing Your First PluginWriting Your First Plugin
Writing Your First Plugin
George Ornbo549 views
Symfony framework-An overview and usability for web development by ifour_bhavesh
Symfony framework-An overview and usability for web developmentSymfony framework-An overview and usability for web development
Symfony framework-An overview and usability for web development
ifour_bhavesh487 views
UI Design for Themes and Plugins by Chelsea Otakan & Sara Cannon by Sara Cannon
UI Design for Themes and Plugins by Chelsea Otakan & Sara CannonUI Design for Themes and Plugins by Chelsea Otakan & Sara Cannon
UI Design for Themes and Plugins by Chelsea Otakan & Sara Cannon
Sara Cannon3.8K views
CRM Science - Dreamforce '14: From Admin to Developer: Learning to Code on F... by CRMScienceKirk
CRM Science - Dreamforce '14:  From Admin to Developer: Learning to Code on F...CRM Science - Dreamforce '14:  From Admin to Developer: Learning to Code on F...
CRM Science - Dreamforce '14: From Admin to Developer: Learning to Code on F...
CRMScienceKirk558 views

Similar to WP json api

WORDPRESS_REST_API_WORDPRESS_REST_API.pdf by
WORDPRESS_REST_API_WORDPRESS_REST_API.pdfWORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdfAngy668409
3 views17 slides
WordPress Plugins You Cannot Live Without by
WordPress Plugins You Cannot Live WithoutWordPress Plugins You Cannot Live Without
WordPress Plugins You Cannot Live WithoutInternet Marketing Muscle
783 views15 slides
Using WordPress as a web application platform by
Using WordPress as a web application platformUsing WordPress as a web application platform
Using WordPress as a web application platformJoe Querin
442 views11 slides
How to create your own WordPress plugin using WP App Studio by
How to create your own WordPress plugin using WP App StudioHow to create your own WordPress plugin using WP App Studio
How to create your own WordPress plugin using WP App StudioeMarket Design
357 views30 slides
Wordpress for Newbies 2010-03-27 by
Wordpress for Newbies 2010-03-27Wordpress for Newbies 2010-03-27
Wordpress for Newbies 2010-03-27Shannon Smith
5.2K views36 slides
WordPress Search Engine Optimisation by
WordPress Search Engine OptimisationWordPress Search Engine Optimisation
WordPress Search Engine OptimisationPeter Bui
716 views14 slides

Similar to WP json api(20)

WORDPRESS_REST_API_WORDPRESS_REST_API.pdf by Angy668409
WORDPRESS_REST_API_WORDPRESS_REST_API.pdfWORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
Angy6684093 views
Using WordPress as a web application platform by Joe Querin
Using WordPress as a web application platformUsing WordPress as a web application platform
Using WordPress as a web application platform
Joe Querin442 views
How to create your own WordPress plugin using WP App Studio by eMarket Design
How to create your own WordPress plugin using WP App StudioHow to create your own WordPress plugin using WP App Studio
How to create your own WordPress plugin using WP App Studio
eMarket Design357 views
Wordpress for Newbies 2010-03-27 by Shannon Smith
Wordpress for Newbies 2010-03-27Wordpress for Newbies 2010-03-27
Wordpress for Newbies 2010-03-27
Shannon Smith5.2K views
WordPress Search Engine Optimisation by Peter Bui
WordPress Search Engine OptimisationWordPress Search Engine Optimisation
WordPress Search Engine Optimisation
Peter Bui716 views
What's New for Developers in SharePoint 2010 by Geoff Varosky
What's New for Developers in SharePoint 2010What's New for Developers in SharePoint 2010
What's New for Developers in SharePoint 2010
Geoff Varosky1.3K views
Introduction to WordPress REST API by Simone D'Amico
Introduction to WordPress REST APIIntroduction to WordPress REST API
Introduction to WordPress REST API
Simone D'Amico2.3K views
WordCamp Wilmington 2017 WP-API Why? by Evan Mullins
WordCamp Wilmington 2017   WP-API Why?WordCamp Wilmington 2017   WP-API Why?
WordCamp Wilmington 2017 WP-API Why?
Evan Mullins1.9K views
Wordpress Meetup 2 23 10 by boonebgorges
Wordpress Meetup 2 23 10Wordpress Meetup 2 23 10
Wordpress Meetup 2 23 10
boonebgorges1.3K views
Best Wordpress Plug-Ins - SEMpdx Searchfest 2009 by David Wallace
Best Wordpress Plug-Ins - SEMpdx Searchfest 2009Best Wordpress Plug-Ins - SEMpdx Searchfest 2009
Best Wordpress Plug-Ins - SEMpdx Searchfest 2009
David Wallace5.2K views
Beginners' Guide to WordPress by Shannon Smith
Beginners' Guide to WordPressBeginners' Guide to WordPress
Beginners' Guide to WordPress
Shannon Smith1.9K views
A Beginner's Guide to WordPress - WordCamp Montreal 2012 by Kathryn Presner
A Beginner's Guide to WordPress - WordCamp Montreal 2012A Beginner's Guide to WordPress - WordCamp Montreal 2012
A Beginner's Guide to WordPress - WordCamp Montreal 2012
Kathryn Presner3K views
New web technologies we must explore in 2018 by Alexander Dimitrov
New web technologies we must explore in 2018New web technologies we must explore in 2018
New web technologies we must explore in 2018
Alexander Dimitrov107 views
WordCamp Raleigh 2016 - WP API, What is it good for? Absolutely Everything! by Evan Mullins
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 Mullins1K views
Top 100 wordpress plugins by guz393
Top 100 wordpress pluginsTop 100 wordpress plugins
Top 100 wordpress plugins
guz3933.3K views
So, you want to be a plugin developer? by ylefebvre
So, you want to be a plugin developer?So, you want to be a plugin developer?
So, you want to be a plugin developer?
ylefebvre19.9K views
WordPress Plugin Development- Rich Media Institute Workshop by Brendan Sera-Shriar
WordPress Plugin Development- Rich Media Institute WorkshopWordPress Plugin Development- Rich Media Institute Workshop
WordPress Plugin Development- Rich Media Institute Workshop

More from Paul Bearne

Childthemes ottawa-word camp-1919 by
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Paul Bearne
531 views33 slides
Vagrant WordCamp Hamilton by
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
739 views39 slides
Using WordPress as your application stack by
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stackPaul Bearne
1.2K views22 slides
Unit tests with vagrant by
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrantPaul Bearne
1.5K views20 slides
WordPress overloading Gravityforms using hooks, filters and extending classes by
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes Paul Bearne
3.7K views21 slides
How To Set a Vagrant Development System by
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development SystemPaul Bearne
17.8K views27 slides

More from Paul Bearne(10)

Childthemes ottawa-word camp-1919 by Paul Bearne
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
Paul Bearne531 views
Vagrant WordCamp Hamilton by Paul Bearne
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
Paul Bearne739 views
Using WordPress as your application stack by Paul Bearne
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stack
Paul Bearne1.2K views
Unit tests with vagrant by Paul Bearne
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrant
Paul Bearne1.5K views
WordPress overloading Gravityforms using hooks, filters and extending classes by Paul Bearne
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes
Paul Bearne3.7K views
How To Set a Vagrant Development System by Paul Bearne
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
Paul Bearne17.8K views
HirshHorn theme: how I created it by Paul Bearne
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
Paul Bearne2.8K views
WortdPress Child themes: Why and How by Paul Bearne
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and How
Paul Bearne4.1K views
Daughter Themes by Paul Bearne
Daughter ThemesDaughter Themes
Daughter Themes
Paul Bearne1.5K views
Author Avatars List demo slides by Paul Bearne
Author Avatars List demo slidesAuthor Avatars List demo slides
Author Avatars List demo slides
Paul Bearne1.2K views

Recently uploaded

BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
8 views49 slides
JioEngage_Presentation.pptx by
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptxadmin125455
6 views4 slides
Sprint 226 by
Sprint 226Sprint 226
Sprint 226ManageIQ
10 views18 slides
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx by
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptxanimuscrm
15 views19 slides
ShortStory_qlora.pptx by
ShortStory_qlora.pptxShortStory_qlora.pptx
ShortStory_qlora.pptxpranathikrishna22
5 views10 slides
Navigating container technology for enhanced security by Niklas Saari by
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas SaariMetosin Oy
14 views34 slides

Recently uploaded(20)

BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
JioEngage_Presentation.pptx by admin125455
JioEngage_Presentation.pptxJioEngage_Presentation.pptx
JioEngage_Presentation.pptx
admin1254556 views
Sprint 226 by ManageIQ
Sprint 226Sprint 226
Sprint 226
ManageIQ10 views
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx by animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm15 views
Navigating container technology for enhanced security by Niklas Saari by Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy14 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
FIMA 2023 Neo4j & FS - Entity Resolution.pptx by Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j17 views
How Workforce Management Software Empowers SMEs | TraQSuite by TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuiteHow Workforce Management Software Empowers SMEs | TraQSuite
How Workforce Management Software Empowers SMEs | TraQSuite
TraQSuite5 views
Quality Engineer: A Day in the Life by John Valentino
Quality Engineer: A Day in the LifeQuality Engineer: A Day in the Life
Quality Engineer: A Day in the Life
John Valentino7 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi215 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... by sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik8 views
Understanding HTML terminology by artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar56 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan6 views

WP json api

Editor's Notes

  1. Some of smallest patches
  2. I am freelance so I need clients that will pay me to allow me to talk at WordCamp! These are some of my clients that I help with their complex problems whose products you may find useful LivePress is real time microblogging that is native on WordPress. It is available as part of WordPress.com VIP platform.
  3. I am freelance so I need clients that will pay me to allow me to talk at WordCamp! These are some of my clients that I help with their complex problems whose products you may find useful LivePress is real time microblogging that is native on WordPress. It is available as part of WordPress.com VIP platform.
  4. Uncanny Owl are eLearning experts that can help you and your clients provide eLearning solutions
  5. We know it's hard to find a reliable WordPress expert when you need one, which is why we've set on a mission to bring them all to one place: here. Join us and benefit from: a steady income with a guaranteed minimum hourly rate working with great, loyal clients being a part of our reputable expert community
  6. In this talk, I will show you how to use the WP JSON API to add your own end-point for a custom post type or add/change data being returned. I will walk you through real, production level example code that extends the API and  show you how simple it can be and how few lines it takes once you get your head around it.
  7. Json doesn’t load the admin code
  8. Not complete code Mixed v1 1nd 2