In website and server management, the BT Panel can greatly simplify operations. However, for automated maintenance, deep customization, or third-party system integration, directly calling the API interfaces provided by the BT Panel becomes an efficient and powerful option. Postman is a popular API development and testing tool that provides an intuitive and reliable environment for debugging, ensuring that scripts and programs execute their expected tasks accurately. Below is a guide on how to configure Postman and demonstrate how to complete a full BT Panel API call. Even if you don't have much prior API testing experience, you can quickly get started and master this practical skill.
First, ensure you have the latest version of Postman installed. This tool has a user-friendly interface, freeing you from the tediousness of command-line operations. Second, you need to obtain access credentials from the BT Panel; these are the "keys" to all requests. Log in to the BT Panel, find and click "API" in the left navigation bar, and then open the "API Interface" tab. Here, you will see that the BT Panel has automatically generated an API key for you. Please carefully record this information, as it contains two crucial pieces of information: your panel address (usually accompanied by a security entry point), and a key pair consisting of `ak` (API Key) and `sk` (Secret Key). This key has the same high-level privileges as your panel login account, so it must be kept as secure as a password and never disclosed.
After obtaining the key, the next step is to construct a standard request in Postman. We recommend starting by creating a new Collection, which will help you categorize and manage all interfaces related to the BT Panel in the future. Within this Collection, you can click "Add a request" to create a new request. Now, let's familiarize ourselves with the configuration process by calling the commonly used "Get System Basic Statistics" interface. This interface returns core status information of your server, making it ideal as a starting point for initial testing. According to the BT Panel API documentation, the endpoint for this interface is typically
/system?action=GetSystemTotal
and the request method is specified as `POST`.
Next is the most critical part of configuring the request—constructing the request parameters. You need to complete the following steps: First, fill in the complete request URL. Its basic format is `http://your server IP:port number/public/index.php`, followed by the API path, for example:
/system?action=GetSystemTotal
Note that if your panel has a secure entry enabled, be sure to include it in the URL as well. Next, a crucial step is to switch to the "Authorization" tab, select "Bearer Token" as the type, and paste the complete API key you obtained from the BT Panel API interface (in the form `ak|sk`, separated by vertical bars) into the Token field. This is a standard and secure authentication method. After completing these steps, don't forget to switch to the "Body" tab. Because the BT Panel API requires parameters to be submitted in form format, you need to select
x-www-form-urlencoded
and add a required key-value pair here: the key is `request_token`, and the value needs to be a special token generated by MD5 encryption of the current timestamp and SK. While it may sound complicated, the API documentation page of the BT Panel usually provides a convenient "Generate Tag" button. You can directly click it to obtain this instantly valid `request_token` value, which you can then copy and use.
Once all parameters are set correctly, click the yellow "Send" button, and a request will be sent out. At this point, your attention should be focused on the response area in the lower half of Postman. If everything goes smoothly, you will see a response with a status code of 200 in the "Body" section. Its content is clearly returned server data in JSON format, such as disk usage and memory consumption, indicating that your first API call has been successfully completed. However, debugging is not always smooth sailing. If the response status code is 4xx or 5xx, or if you find error messages in the JSON body, remain calm.
At this point, you should become a meticulous detective: carefully check that your `ak` and `sk` are accurate and without extra spaces; confirm that the URL port number of the request matches the actual port on which the panel is running; repeatedly verify that the `request_token` is used very quickly after generation, as it has a time limit. Systematic troubleshooting can always help you locate and resolve problems. By performing such pre-testing with Postman, you can verify interface logic and preview returned data without impacting the production environment. This lays a solid foundation for writing reliable automation scripts, making server management more intelligent and efficient.