SlideShare una empresa de Scribd logo
1 de 13
MAKING USE OF A LITTLE-KNOWN GEM:
THE WORDPRESS HTTP API
RYAN DUFF
WordCamp US 2015
A FEW QUICK
QUESTIONS
MY THEORY ON
cURL USAGE
WHY
USING cURL
IS BAD
THE
WORDPRESS
HTTP API
4 EASY TO USE WRAPPER FUNCTIONS
wp_remote_get()
wp_remote_post()
wp_remote_head()
wp_remote_request()
wp_safe_remote_*()
PROCESSING RESPONSES
wp_remote_retrieve_body()
wp_remote_retrieve_header()
wp_remote_retrieve_headers()
wp_remote_retrieve_response_code()
wp_remote_retrieve_response_message()
REQUESTS
FOR PHP
A QUICK SIDEBAR
ON CACHING
USEFUL API TOOLS
POSTMAN
Chrome app
Free
PAW
Mac only (OS X 10.9+)
$29.99 (Free trial; 30%
discount for students)
Extension to create HTTP API
code from results
LINKS
https://developer.wordpress.org/plugins/http-api/
https://codex.wordpress.org/HTTP_API
http://requests.ryanmccue.info/
https://core.trac.wordpress.org/ticket/33055
https://www.getpostman.com/
https://luckymarmot.com/paw
https://luckymarmot.com/paw/extensions/WordPressCode
Generator
QUESTIONS/CONTACT
RYAN DUFF
ryan@fusionized.com
http://fusionized.com
@ryancduff

Más contenido relacionado

La actualidad más candente

WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
Word camp2011 introwordpresssecurity
Word camp2011 introwordpresssecurityWord camp2011 introwordpresssecurity
Word camp2011 introwordpresssecurity
David Wilemski
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
Barry Abrahamson
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
Barry Abrahamson
 

La actualidad más candente (20)

Getting Started With WordPress Plugin Development
Getting Started With WordPress Plugin DevelopmentGetting Started With WordPress Plugin Development
Getting Started With WordPress Plugin Development
 
A crash course in scaling wordpress
A crash course inscaling wordpress A crash course inscaling wordpress
A crash course in scaling wordpress
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
WP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp Montreal
 
Why it's dangerous to turn off automatic updates and here's how to do it
Why it's dangerous to turn off automatic updates and here's how to do itWhy it's dangerous to turn off automatic updates and here's how to do it
Why it's dangerous to turn off automatic updates and here's how to do it
 
WordPress Security
WordPress SecurityWordPress Security
WordPress Security
 
Improving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP ProfilingImproving WordPress Performance with Xdebug and PHP Profiling
Improving WordPress Performance with Xdebug and PHP Profiling
 
WordPress.org & Optimizing Security for your WordPress sites
WordPress.org & Optimizing Security for your WordPress sitesWordPress.org & Optimizing Security for your WordPress sites
WordPress.org & Optimizing Security for your WordPress sites
 
Ako na vlastne WP temy
Ako na vlastne WP temyAko na vlastne WP temy
Ako na vlastne WP temy
 
Word camp2011 introwordpresssecurity
Word camp2011 introwordpresssecurityWord camp2011 introwordpresssecurity
Word camp2011 introwordpresssecurity
 
High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010High Performance WordPress - WordCamp Jerusalem 2010
High Performance WordPress - WordCamp Jerusalem 2010
 
Wordpress vs Google Blogger/ Wampserver
Wordpress vs Google Blogger/ WampserverWordpress vs Google Blogger/ Wampserver
Wordpress vs Google Blogger/ Wampserver
 
Managing Multisite: Lessons from a Large Network
Managing Multisite: Lessons from a Large NetworkManaging Multisite: Lessons from a Large Network
Managing Multisite: Lessons from a Large Network
 
Save 15 Minutes or More on WordPress
Save 15 Minutes or More on WordPressSave 15 Minutes or More on WordPress
Save 15 Minutes or More on WordPress
 
High Performance WordPress II
High Performance WordPress IIHigh Performance WordPress II
High Performance WordPress II
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
 
Ship WordPress Projects Like a Boss
Ship WordPress Projects Like a BossShip WordPress Projects Like a Boss
Ship WordPress Projects Like a Boss
 
High Performance WordPress
High Performance WordPressHigh Performance WordPress
High Performance WordPress
 
Leeward WordPress Meetup- Caching and Website Speed
Leeward WordPress Meetup- Caching and Website SpeedLeeward WordPress Meetup- Caching and Website Speed
Leeward WordPress Meetup- Caching and Website Speed
 
ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007ServerBeach and WordPress BlogWorldExpo 2007
ServerBeach and WordPress BlogWorldExpo 2007
 

Destacado

WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practices
ryanduff
 
Question 3 review of feedback
Question 3 review of feedbackQuestion 3 review of feedback
Question 3 review of feedback
aaronmc165
 
Biografia De Gil Eanes
Biografia De Gil EanesBiografia De Gil Eanes
Biografia De Gil Eanes
crie_historia8
 

Destacado (17)

Extending Custom Post Types
Extending Custom Post Types Extending Custom Post Types
Extending Custom Post Types
 
doing_it_right() with WordPress
doing_it_right() with WordPressdoing_it_right() with WordPress
doing_it_right() with WordPress
 
Rack
RackRack
Rack
 
WordCamp Lancaster - Choosing WordPress Themes and Plugins
WordCamp Lancaster - Choosing WordPress Themes and PluginsWordCamp Lancaster - Choosing WordPress Themes and Plugins
WordCamp Lancaster - Choosing WordPress Themes and Plugins
 
WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practices
 
Sales coaching vijf mythen ontkracht
Sales coaching vijf mythen ontkrachtSales coaching vijf mythen ontkracht
Sales coaching vijf mythen ontkracht
 
An evening with... Apache hadoop Meetup
An evening with...  Apache hadoop MeetupAn evening with...  Apache hadoop Meetup
An evening with... Apache hadoop Meetup
 
Question 3 review of feedback
Question 3 review of feedbackQuestion 3 review of feedback
Question 3 review of feedback
 
The environment
The environmentThe environment
The environment
 
Theories of Personality
Theories of PersonalityTheories of Personality
Theories of Personality
 
Second Annual Employee Engagement Study
Second Annual Employee Engagement StudySecond Annual Employee Engagement Study
Second Annual Employee Engagement Study
 
Biografia De Gil Eanes
Biografia De Gil EanesBiografia De Gil Eanes
Biografia De Gil Eanes
 
Codes and conventions of print documentary adverts
Codes and conventions of print documentary advertsCodes and conventions of print documentary adverts
Codes and conventions of print documentary adverts
 
Vincent Van Gogh
Vincent Van GoghVincent Van Gogh
Vincent Van Gogh
 
Information Visualisation - Lecture 1
Information Visualisation - Lecture 1Information Visualisation - Lecture 1
Information Visualisation - Lecture 1
 
Sss congruence Postulate
Sss congruence PostulateSss congruence Postulate
Sss congruence Postulate
 
Andy warhol
Andy warholAndy warhol
Andy warhol
 

Similar a Ryan Duff 2015 WordCamp US HTTP API

Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for Researchers
Fatemeh Khast Khoda
 
2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
PHP Conference Argentina
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
10n Software, LLC
 
PHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and FrameworksPHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and Frameworks
Royston Olivera
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jao
jedt
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
hazzaz
 
Securing the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfoSecuring the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfo
funkatron
 

Similar a Ryan Duff 2015 WordCamp US HTTP API (20)

WP REST API - Building a simple Web Application
WP REST API - Building a simple Web ApplicationWP REST API - Building a simple Web Application
WP REST API - Building a simple Web Application
 
Don't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and JoomlaDon't worry be API with Slim framework and Joomla
Don't worry be API with Slim framework and Joomla
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for Researchers
 
Introduction to WordPress Rest API
Introduction to WordPress Rest APIIntroduction to WordPress Rest API
Introduction to WordPress Rest API
 
Building WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmiaBuilding WordPress Client Side Applications with WP and WP-API - #wcmia
Building WordPress Client Side Applications with WP and WP-API - #wcmia
 
PHP on Windows
PHP on WindowsPHP on Windows
PHP on Windows
 
PHP on Windows
PHP on WindowsPHP on Windows
PHP on Windows
 
2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real2013 - Dustin whittle - Escalando PHP en la vida real
2013 - Dustin whittle - Escalando PHP en la vida real
 
Integrating External APIs with WordPress
Integrating External APIs with WordPressIntegrating External APIs with WordPress
Integrating External APIs with WordPress
 
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdfWORDPRESS_REST_API_WORDPRESS_REST_API.pdf
WORDPRESS_REST_API_WORDPRESS_REST_API.pdf
 
Slides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetingsSlides from LAX & DEN usergroup meetings
Slides from LAX & DEN usergroup meetings
 
PHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and FrameworksPHP - History, Introduction, Summary, Extensions and Frameworks
PHP - History, Introduction, Summary, Extensions and Frameworks
 
Api manager preconference
Api manager preconferenceApi manager preconference
Api manager preconference
 
An Introduction to Websphere sMash for PHP Programmers
An Introduction to Websphere sMash for PHP ProgrammersAn Introduction to Websphere sMash for PHP Programmers
An Introduction to Websphere sMash for PHP Programmers
 
Laravel 5 New Features
Laravel 5 New FeaturesLaravel 5 New Features
Laravel 5 New Features
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jao
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
 
Securing the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfoSecuring the PHP Environment with PHPSecInfo
Securing the PHP Environment with PHPSecInfo
 
MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5 MidwestPHP 2016 - Adventures in Laravel 5
MidwestPHP 2016 - Adventures in Laravel 5
 

Último

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Notas del editor

  1. Who has used cURL in a WordPress-based project? Who knows about the WordPress HTTP API?
  2. Easy to copy/paste from API demos into code.
  3. A method of making http requests via php libcurl required on the server, therefore not always available Not the only transport Server support is hit or miss, curl is probably the most common A mess to use
  4. A method of making http requests via php libcurl required on the server, therefore not always available Not the only transport Server support is hit or miss, curl is probably the most common A mess to use
  5. Class that facilitates http requests Should work with pretty much any transport available Easy to use methods Been around since version 2.7 (December 2008)
  6. Do pretty much exactly what you’d expect them to Arguments are mostly the same but some take a slightly different set based on function wp_remote_request allows you to do other HTTP methods (PUT, DELETE, etc) and first 3 are actually just wrappers for wp_remote_request() that just specify GET, POST, and HEAD for you *All return the RAW request data and return WP_Error object on failure use safe functions for when URL isn’t hard coded or comes from user input
  7. Preferred way to test responses and get the part you need Handles WP_Error checking
  8. Will be swapped in for HTTP API Wrapper functions that currently exist will work the same
  9. Often overlooked, cache your API requests
  10. Thanks Matt Boynes at Alley Interactive for the Paw extension!