Building a stable API is not one of the simplest tasks in web development. But, once you have one, hundreds of third-party applications will be requesting to connect to the API, including potential hackers. So it's important to protect your API from malicious requests and avoid an unnecessary overload of traffic. Therefore, we can request an API authentication before providing access to the user.
The existing API functions come built-in with user authentication, hence, we had to use user credentials in the section where we retrieved a list of projects and services. Here, we need to manually implement authentication for custom API methods. Let's create another API method for subscribing to developers of portfolio application. This feature is already implemented in the admin dashboard using admin list tables. Now, we are going to provide the same functionality for API users. Let's get started by modifying the xml_rpc_api
function as follows:
public function...