Book Image

WordPress Web Application Development

By : Rakhitha Nimesh Ratnayake
Book Image

WordPress Web Application Development

By: Rakhitha Nimesh Ratnayake

Overview of this book

Table of Contents (19 chapters)
WordPress Web Application Development Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building the API client


WordPress provides 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:

  • The API server: This is the application where the API function resides

  • The API client: This is a third-party application or service that requests the functionality of an API

Since we will use the existing API functions, we don't need to worry about the server, as it's built inside the core. So, we will build a third-party client to access the service. Later, we will improve the API server to implement custom functionalities that go beyond the existing API functions. The API client is responsible for providing the following features:

  • Authenticating the user with the API

  • Making XML-RPC requests to the server through the curl command

  • Defining and populating the API functions with the necessary parameters

With the preceding features in mind, let's look at the implementation of an API client:

class...