aaPanel Linux Panel API Documentation
Foreword
Through the aaPanel API, you can fully control all the functions of the aaPanel Linux panel.
In fact, all the functions used after the user logs in to the panel are also docked through the same interface, which means
that if you are familiar with the browser debugger, you can easily Complete a third-party front-end docking against the
operational parameters of the aaPanel Linux panel.
Signature algorithm
api_sk = Interface key (obtained in the panel settings page - API interface)
request_time = Uinx timestamp of current request time ( php: time() / python: [Link]() )
request_token = md5(string(request_time) + md5(api_sk))
PHP Example: $request_token = md5($request_time . ‘’ . md5($api_sk))
signature:
Parameter name Parameter value Description
request_time Current uinx timestamp [Must]
request_token md5(string(request_time) + md5(api_sk)) [Must]
Other parameters Other parameters required by the functional interface [Optional]
Precautions:
1. Please use the POST method to request the API interface.
2. In order to ensure the efficiency of the request, please save the cookie and attach a cookie on each request.
3. For panel security considerations, be sure to add an IP whitelist
4. All response content is unified into Json data format
DEMO download
PHP-Demo: [Link]
System status related interface
Get system basic statistics
URI address:/system?action=GetSystemTotal
Incoming parameters:No
Response:
Field Field value example Description
system CentOS Linux 7.5.1804 (Core) Operating system information
version 6.8.2 Panel version
time 0 天 23 小时 45 分钟 The time since the last boot to the present
cpuNum 2 CPU core number
cpuRealUsed 2.01 CPU usage (percentage)
memTotal 1024 Physical memory capacity (MB)
memRealUsed 300 Used physical memory (MB)
memFree 724 Available physical memory (MB)
memCached 700 Cached memory (MB)
memBuffers 100 System buffer (MB)
Response content example:
{
"cpuRealUsed": 0.85,
"memTotal": 1741,
"system": "CentOS Linux 7.5.1804 (Core)",
"memRealUsed": 691,
"cpuNum": 6,
"memFree": 189,
"version": "6.8.1",
"time": "0\u592923\u5c0f\u65f657\u5206\u949f",
"memCached": 722,
"memBuffers": 139,
"isuser": 0
}
Get disk partition information
URI address:/system?action=GetDiskInfo
Incoming parameters:No
Response:
Field Field value example Description
[].path / Partition mount point
[].inodes ["8675328", "148216", "8527112", "2%"] Partition Inode Usage Information [Total, Used, Available,
Usage]
[].size ["8.3G", "4.0G", "4.3G", "49%"] Partition capacity usage information [total, used, available,
usage]
Response content example:
[
{"path": "/",
"inodes": ["8675328", "148216", "8527112", "2%"],
"size": ["8.3G", "4.0G", "4.3G", "49%"]
},
{
"path": "/www",
"inodes": ["655360", "295093", "360267", "46%"],
"size": ["9.8G", "3.7G", "5.6G", "40%"]
}
]
Get real-time status information (CPU, memory, network, load)
URI address:/system?action=GetNetWork
Incoming parameters:No
Response:
Field Field value example Description
downTotal 446326699 Total reception (number of bytes)
upTotal 77630707 Total transmission (number of bytes)
downPackets 1519428 Total collection (a)
upPackets 175326 Total delivery (a)
down 36.22 Downstream traffic (KB)
up 72.81 Upstream traffic (KB)
cpu [1.87, 6] CPU real-time information [usage rate, core number]
mem {memFree: 189, memTotal: 1741, memCached: Memory real-time information
722, memBuffers: 139, memRealUsed: 691}
load {max: 12, safe: 9, one: 0, five: 0.01, limit: 12, Load real-time information one: 1 minute five: 5
fifteen: 0.05} minutes fifteen: 10 minutes
Response content example:
{
"load": {"max": 12, "safe": 9.0, "one": 0.01, "five": 0.02, "limit": 12, "fifteen": 0.05},
"down": 8.77,
"downTotal": 453078627,
"mem": {"memFree": 189, "memTotal": 1741, "memCached": 722, "memBuffers": 140, "memRealUsed": 690},
"up": 4.33,
"upTotal": 78070942,
"upPackets": 177930,
"downPackets": 1548192,
"cpu": [0.23, 6]
}
Check for installation tasks
URI address:/ajax?action=GetTaskCount
传入参数:无
Incoming parameters:No
Response:0
Check panel update
URI address:/ajax?action=UpdatePanel
Parameter name Parameter value Description
check true Force check for updates [Optional]
force true Perform an update [Optional]
Response content:
Field Field value example Description
status true Get state true|false
version 6.3.1 Latest version number
updateMsg string Upgrade Instructions
Response content example:
{
"status": true,
"version": "6.3.1",
"updateMsg": "Upgrade Instructions"
}
Website management
Get a list of websites
URI address:/data?action=getData&table=sites
Parameter name Parameter value Description
p 1 Current page [optional]
limit 15 Number of rows retrieved [must pass]
type -1 Classification ID, -1: Sub-category 0: Default classification [Optional]
order id desc Sorting rules Use id descending order: id desc Use name ascending order: name
desc [Optional]
tojs get_site_list Paginated JS callback, if not passed, construct URI paging connection [Optional]
search www Search content [optional]
Response content:
Field Field value example Description
data [] Site list data
page Paging data
where type_id=0 Data query condition
Response content example:
{
"data": [
{
"status": "1",
"ps": "[Link]",
"domain": 1,
"name": "[Link]",
"addtime": "2018-12-14 16:14:03",
"path": "/www/wwwroot/[Link]",
"backup_count": 0,
"edate": "0000-00-00",
"id": 64
}
],
"where": "type_id=0",
"page": "<div><span class='Pcurrent'>1</span><span class='Pcount'>\u51711\u6761\u6570\u636e</span></div>"
}
Get website classification
URI address:/site?action=get_site_types
Incoming parameters: empty
Response content example:
[
{"id": 0, "name": "\u9ed8\u8ba4\u5206\u7c7b"}
]
Get a list of installed PHP versions
URI address:/site?action=GetPHPVersion
Incoming parameters: empty
Response content example:
[
{"version": "00", "name": "\u7eaf\u9759\u6001"},
{"version": "56", "name": "PHP-56"},
{"version": "72", "name": "PHP-72"}
]
Create a website
URI address:/site?action=AddSite
Parameter Parameter value Description
name
webname {"domain":"[Link]","domainlist":[],"count":0} Website main domain name and domain name
list Please pass JSON [Must]
path /www/wwwroot/[Link] Root directory [Must]
type_id 0 Classification mark [Must]
type PHP Project type Please pass PHP [Must]
version 72 PHP version Please select from the PHP version
list [Must]
port 80 Website port [Must]
ps test Website Remarks [Must]
ftp true|false Whether to create FTP [Must]
ftp_username w1_hao_com FTP username must be passed when you want
to create FTP
ftp_password WCBZ6cH87raERzXc FTP password must be passed when you want to
create FTP
sql true|false Whether to create a database [Must]
codeing utf8|utf8mb4|gbk|big5 Database character set must pass when you
want to create a database
datauser w1_hao_com Database username and name must be passed
when you want to create a database
datapassword PdbNjJy5hBA346AR Database password must be passed when you
want to create a database
Response content:
Field Field value example Description
siteStatus true|false Whether the website was created successfully
ftpStatus true|false Whether FTP is successfully created
ftpUser w2_hao_com FTP username
ftpPass sRxmY6xCn6zEsFtG FTP password
databaseStatus true|false Whether the database was created successfully
databaseUser w2_hao_com Database username and name
databasePass PdbNjJy5hBA346AR Database password
Response content example:
{
"ftpStatus": true,
"databaseUser": "w2_hao_com",
"databaseStatus": true,
"ftpUser": "w2_hao_com",
"databasePass": "PdbNjJy5hBA346AR",
"siteStatus": true,
"ftpPass": "sRxmY6xCn6zEsFtG"
}
Delete website
URI address:/site?action=DeleteSite
Parameter name Parameter value Description
id 66 Website ID [Must]
webname w2_hao_com Site name [Must]
ftp 1 Whether to delete the associated FTP, if you do not delete, please do not pass
this parameter [Optional]
database 1 Whether to delete the associated database, if you do not delete, please do not
pass this parameter [Optional]
path 1 Whether to delete the website root directory, if you do not delete, please do not
pass this parameter [Optional]
Response content:
Field Field value example Description
status true|false Whether the operation is successful
msg successfully deleted! Prompt content
Response content example:
{
"status": true,
"msg": "\u7ad9\u70b9\u5220\u9664\u6210\u529f!"
}
Stop website
URI address:/site?action=SiteStop
Parameter name Parameter value Description
id 66 Website ID [Must]
name [Link] Website name (main domain) [Must]
Response content example:
{
"status": true,
"msg": "\u7ad9\u70b9\u5220\u9664\u6210\u529f!"
}
Start website
URI address:/site?action=SiteStart
Parameter name Parameter value Description
id 66 Website ID [Must]
name [Link] Website name (main domain) [Must]
Response content example:
{
"status": true,
"msg": "\u7ad9\u70b9\u5df2\u542f\u7528"
}
Website expiration time
URI 地址:/site?action=SetEdate
Parameter name Parameter value Description
id 66 Website ID [Must]
edate 2019-01-01 Expiration time Permanent: 0000-00-00 [Must]
Response content example:
{
"status": true,
"msg": "\u7ad9\u70b9\u5df2\u542f\u7528"
}
Modify website notes
URI address:/data?action=setPs&table=sites
Parameter name Parameter value Description
id 66 Website ID [Must]
ps test Remarks [Must]
Response content example:
{
"status": true,
"msg": "\u4fee\u6539\u6210\u529f"
}
Get a list of website backups
URI address:/data?action=getData&table=backup
Parameter name Parameter value Description
p 1 Current page [Optional]
limit 5 The number of data rows retrieved per page [Must]
type 0 Backup type, please pass 0 fixed [Must]
tojs get_site_backup Paginated JS callback, if not passed, construct URI paging connection [Optional]
search 66 Website ID [Must]
Response content:
Parameter name Parameter value Description
data [] Backup list data
page Paging data
where type_id=0 Data query condition
Response content example:
{
"data": [],
"where": "pid=65 and type='0'",
"page": "<div><span class='Pcurrent'>1</span><span class='Pcount'>\u51710\u6761\u6570\u636e</span></div>"
}
Create a website backup
URI address:/site?action=ToBackup
Parameter name Parameter value Description
id 66 Website ID [Must]
Response content example:
{
"status": true,
"msg": "\u5907\u4efd\u6210\u529f!"
}
Delete website backup
URI address:/site?action=DelBackup
Parameter name Parameter value Description
id 121 Backup list ID [Must]
Response content example:
{
"status": true,
"msg": "\u5220\u9664\u6210\u529f"
}
Get a list of domain names for your site
URI address:/data?action=getData&table=domain
Parameter name Parameter value Description
search 66 Website ID [Must]
list true Must pass true
Response content example:
[
{
"port": 80,
"addtime": "2018-12-15 16:57:30",
"pid": 65,
"id": 73,
"name": "[Link]"
}
]
Add domain name
URI address:/site?action=AddDomain
Parameter name Parameter value Description
id 66 Website ID [Must]
webname [Link] Site name [Must]
domain [Link] The domain name to be added: port 80, the end product does not have to
construct a port, and multiple domain names are separated by a newline [Must]
Response content example:
{
"status": true,
"msg": "\u57df\u540d\u6dfb\u52a0\u6210\u529f!"
}
Delete domain name
URI address:/site?action=DelDomain
Parameter name Parameter value Description
id 66 Website ID [Must]
webname [Link] Site name [Must]
domain [Link] Domain name to be deleted [Must]
port 80 The port of the domain name [Must]
Response content example:
{
"status": true,
"msg": "\u5220\u9664\u6210\u529f"
}
Get an optional predefined pseudo-static list
URI address:/site?action=GetRewriteList
Parameter name Parameter value Description
siteName [Link] Site name [Must]
Response content:
Field Field value example Description
rewrite [] Predefined pseudo static list
Response content example:
{
"rewrite": ["0.\u5f53\u524d", "EmpireCMS", "dabr", "dbshop", "dedecms", "default", "discuz", "discuzx",
"discuzx2", "discuzx3", "drupal", "ecshop", "emlog", "laravel5", "maccms", "mvc", "niushop", "phpcms", "phpwind",
"sablog", "seacms", "shopex", "thinkphp", "typecho", "typecho2", "weengine", "wordpress", "wp2", "zblog"]
}
Get the specified predefined pseudo-static rule content (get the file content)
URI address:/files?action=GetFileBody
Field Field value example Description
path /www/server/panel/vhost/rewrite/nginx/[Link] The file to be obtained [Must]
f
Save pseudo static rule content (save file content)
URI address:/files?action=SaveFileBody
Field Field value example Description
path /www/server/panel/vhost/rewrite/nginx/名称.conf Save location [Must]
data Rule content
encoding utf-8 File code, please pass it utf-8
Retrieve the root of the specified website
URI address:/data?action=getKey&table=sites&key=path
Field Field value example Description
id 1 Website ID [Must]
Retrieve anti-cross-hop configuration/run directory/log switch status/settable run directory
list/password access status
URI 地址:/site?action=GetDirUserINI
Field Field value example Description
id 1 Website ID [Must]
path /www/wwwroot/[Link] Website root directory [Must]
Response content example:
{
"pass": false, #Whether to set password access
"logs": true, #Whether to write access logs
"userini": true, #Whether to set up anti-crossing station
"runPath": {
"dirs": ["/"], #List of directories that can be used to set the run directory
"runPath": "/" #Current running directory
}
}
Set anti-crossing status (automatic reversal)
URI address:/site?action=SetDirUserINI
Field Field value example Description
path /www/wwwroot/[Link] Website root directory [Must]
Set whether to write access logs
URI address:/site?action=logsOpen
Parameter name Parameter value Description
id 1 Website ID [Must]
Modify the website root directory
URI address:/site?action=SetPath
Parameter name Parameter value Description
id 1 Website ID [Must]
path /www/wwwroot/[Link] New website root directory [Must]
Set whether to write access logs
URI address:/site?action=SetSiteRunPath
Parameter name Parameter value Description
id 1 Website ID [Must]
runPath /public Run directory based on the root of the website
Set password access
URI address:/site?action=SetHasPwd
Parameter name Parameter value Description
id 1 Website ID [Must]
username test username
password admin password
Turn off password access
URI address:/site?action=CloseHasPwd
Parameter name Parameter value Description
id 1 Website ID [Must]
Get traffic limit related configuration (only supports nginx)
URI address:/site?action=GetLimitNet
Parameter name Parameter value Description
id 1 Website ID [Must]
Enable or save traffic limit configuration (only nginx is supported)
URI 地址:/site?action=SetLimitNet
Parameter name Parameter value Description
id 1 Website ID [Must]
perserver 300 Concurrency restrictions [Must]
perip 25 Single IP limit [Must]
limit_rate 512 Traffic limit [Must]
Turn off traffic limits (only nginx is supported)
URI address:/site?action=CloseLimitNet
Parameter name Parameter value Description
id 1 Website ID [Must]
Take the default document information
URI address:/site?action=GetIndex
Parameter name Parameter value Description
id 1 Website ID [Must]
Set default document
URI address:/site?action=SetIndex
Parameter name Parameter value Description
id 1 Website ID [Must]
Index [Link],[Link],[Link],[Link] Default document, each separated by a comma [Must]
p,[Link],[Link]
Take the content of the website configuration file (get the file content)
URI address:/files?action=GetFileBody
Parameter name Parameter value Description
path /www/server/panel/vhost/nginx/[Link] The file to be obtained [Must]
Save the website configuration file (save the file content)
URI address:/files?action=SaveFileBody
Parameter name Parameter value Description
path /www/server/panel/vhost/nginx/[Link] Save location [Must]
data Profile content
encoding utf-8 File encoding Please fill in utf-8