Sorry! Internet Explorer is not supported on this site. Please view on Chrome, Firefox, or Edge.

Having fun at Zao is one of our values. We’ve put limited animated flourishes throughout our site to communicate our love of levity. We also recognize that onscreen movement is not fun or possible for everyone. We've turned off all our animations for you per your browser's request to limit motion. That said, we don't want you to miss out on the party.

Here's a funny joke to enjoy!

Where does the General keep his armies?

In his sleevies!

Zao Mock API: A WordPress Plugin for Testing API Responses

Right now, REST API usage is at an all-time high, especially now that WordPress, which powers 27% of the web, has its own REST API. And it makes absolute sense. There are so many great services and data sources in the world wide web, and there has been a need for those sites/services to “talk” to each other for almost as long as the web has been a thing. REST APIs have long been a subject we are passionate about at Zao.

If you’re not familiar with REST APIs, I recommend doing some reading, and bookmark this article (and plugin) for later.

With the growing usage of REST APIs, there has been an increased offering of tools for testing and working with them. There are some great tools for making REST requests (Paw, Insomnia, Postman) for testing APIs you are building, as well as tools for generating test/sample REST responses (Mocky) for testing API clients.

We’ve created Zao Mock API, a WordPress plugin which falls in the latter category and enables quickly mocking/testing APIs by sending query params to your WordPress site. Simply make a GET/POST/PUT/etc request to <site_url>?mock_api=1. Inspired by Mocky, this plugin was built to allow us (and now you!) to have something self-hosted that we could control. This plugin is a great tool to help you mock REST API HTTP responses to test your REST API client.

If you want to see an example of the plugin in action, check out a few of these links, and try making requests with your favorite API client tool1:

As you can see, you are able to test various HTTP status codes2 and responses.

Check out the README for more examples and documentation of advanced usage.

  1. our favorites are Paw and Insomnia 
  2. If you are not familiar with HTTP status codes, or are looking for more information about them, here is the official documentation. Also useful: It’s extremely important to understand HTTP status codes as the various codes will need to be handled by your API client. 

Leave a comment

Your email address will not be published. Required fields are marked *