WordPress provides the support for its API through the xmlrpc.php
file located inside the root of the installation directory. Basically, we need two components to build and use an API:
API server: This is the application where the API function resides
API client: This is a third-party application or service that requests the functionality of an API
Since we are going to use the existing API functions, we don't need to worry about the server as it's built inside the core. So, we are going to build a third-party client to access the service. Later, we will be improving the API server to implement custom functionalities that go beyond the existing API functions. The API client is responsible for providing the following features:
Authenticate the user with the API
Make XML-RPC requests to the server through the
curl
commandDefine and populate API functions with necessary parameters
Having the preceding features in mind, let's look at the implementation of an API client:
class...