11. 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
Who has used cURL in a WordPress-based project?
Who knows about the WordPress HTTP API?
Easy to copy/paste from API demos into code.
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
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
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)
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
Preferred way to test responses and get the part you need
Handles WP_Error checking
Will be swapped in for HTTP API
Wrapper functions that currently exist will work the same
Often overlooked, cache your API requests
Thanks Matt Boynes at Alley Interactive for the Paw extension!