![]() ![]() So far we’ve only queried the APIs for information, but they can also be used to instruct cPanel to carry out tasks. It returns information about all the domains associated with the account. In this case, we’re accessing the “DomainInfo” module and its “list_domains” function. Many functions are gathered into modules that provide related functionality. The username is given as an option rather than a parameter. One common unknown when starting with our API is understanding how masquerading works. Although the cPanel API is designed to be run as the cPanel user, a root user can masquerade as the cPanel user by specifying `–user=` in the UAPI command. We see that the account has a domain associated with it, so let’s use the cPanel API to find more information. A truncated set of results looks like this: data: Here we’re using the “accountsummary” function, and providing the parameter “user” with the value “user1”. ![]() Now we know which users have accounts on the server, we want to take a deeper look at one account in particular. It does precisely what you’d expect, returning a list of users who have accounts on the server, along with some metadata about the command. We’re using the “whmapi” command to call the “list_users” function. To use them, you need to be logged in to your server with SSH.įirst, let’s see how to query the WHM API for information about a server’s user accounts. ![]() Functionality is split between them in the same way it’s split between the WHM and cPanel web interfaces, so you would use whmapi for server-related tasks and uapi for hosting-related tasks. We provide a pair of command-line utilities for scripting and running commands on your server or hosting account, one for the WHM API (whmapi) and the cPanel API (uapi). Accessing the cPanel API From Your Server In short, our APIs help users and developers to leverage cPanel’s sophisticated server and hosting administration technologies to solve problems, save time, and build flexible tools for their users. Many cPanel extensions build on the APIs. You can use the APIs to extend cPanel’s functionality.A web host might use the API to collect data to display in a dashboard. They allow cPanel to integrate with other tools.That script could run on the same server as cPanel or a different server that sends commands over the internet. ![]() For example, as we’ll see in the next section, you can trigger a backup from a script using the API. They allow users to automate tasks rather than do them manually.There are several benefits to using the APIs. To use the APIs, you send a command, and cPanel responds by carrying out an action, which could be to change a setting, perform a server administration task, or tell you some information. The cPanel & WHM APIs (Application Programming Interfaces) allow users to access the software’s built-in functionality without going through the web interface. In this article, we’ll explore the cPanel & WHM APIs and show you how to get started with cPanel’s command-line API utilities and the HTTP API. We have recently updated our API documentation as well at What Is The cPanel API? To make that easier, we provide extensive APIs that can be accessed both locally and remotely. CPanel & WHM’s web interfaces offer a comprehensive server and web hosting management solution, but hosts and developers often want to automate tasks or integrate cPanel’s tools with other software. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |