Talking to Other Sites
with the WP HTTP API
Presenter
Topher DeRosia
@topher1kenobe
Date
13 July 2019
Why Talk To Other Sites?
Eventbrite
A complete API for managing events.
https://www.eventbrite.com/platform/
CIA World Fact Book
Details about every country in the world.
https://iancoleman.io/exploring-the-cia-
world-factbook/
The Movie Database API (TMDb)
All the data about every movie ever
made.
https://developers.themoviedb.org/3/ge
tting-started/introduction
To ask them questions. How many tickets are left for my favorite concert? What
movies are playing this week? How many people live in Sri Lanka?
To tell them things. Buy that ticket. Email me when a certain movie appears.
How is this done?
Always look at https://codex.wordpress.org/HTTP_API
• wp_remote_get() - Retrieves a URL using the GET HTTP method.
• wp_remote_post() - Retrieves a URL using the POST HTTP method.
• wp_remote_head() - Retrieves a URL using the HEAD HTTP method.
• wp_remote_request() - Retrieves a URL using either the default GET or a custom HTTP method (should be caps) that you
specify.
Examples
https://joshuaproject.net/resources/datasets
All people groups in a specific country
http://joshuaproject.net/api/v2/people_groups?ROG3=YM&api_key=aWye9lV20QtF
A people group in a specific country
http://joshuaproject.net/api/v2/people_groups?ROG3=AF&PeopleID3=19409&api_key=aWye9lV20QtF
All countries a specific people group lives in
http://joshuaproject.net/api/v2/people_groups?PeopleID3=10294&api_key=aWye9lV20QtF
Thank you
Make WordPress Slack: @topher1kenobe
Twitter: @topher1kenobe
Email: topher@bigcommerce.com

Talking to Other Sites with the WP HTTP API

  • 1.
    Talking to OtherSites with the WP HTTP API Presenter Topher DeRosia @topher1kenobe Date 13 July 2019
  • 2.
    Why Talk ToOther Sites? Eventbrite A complete API for managing events. https://www.eventbrite.com/platform/ CIA World Fact Book Details about every country in the world. https://iancoleman.io/exploring-the-cia- world-factbook/ The Movie Database API (TMDb) All the data about every movie ever made. https://developers.themoviedb.org/3/ge tting-started/introduction To ask them questions. How many tickets are left for my favorite concert? What movies are playing this week? How many people live in Sri Lanka? To tell them things. Buy that ticket. Email me when a certain movie appears.
  • 3.
    How is thisdone? Always look at https://codex.wordpress.org/HTTP_API • wp_remote_get() - Retrieves a URL using the GET HTTP method. • wp_remote_post() - Retrieves a URL using the POST HTTP method. • wp_remote_head() - Retrieves a URL using the HEAD HTTP method. • wp_remote_request() - Retrieves a URL using either the default GET or a custom HTTP method (should be caps) that you specify.
  • 4.
    Examples https://joshuaproject.net/resources/datasets All people groupsin a specific country http://joshuaproject.net/api/v2/people_groups?ROG3=YM&api_key=aWye9lV20QtF A people group in a specific country http://joshuaproject.net/api/v2/people_groups?ROG3=AF&PeopleID3=19409&api_key=aWye9lV20QtF All countries a specific people group lives in http://joshuaproject.net/api/v2/people_groups?PeopleID3=10294&api_key=aWye9lV20QtF
  • 5.
    Thank you Make WordPressSlack: @topher1kenobe Twitter: @topher1kenobe Email: topher@bigcommerce.com