请选择 进入手机版 | 继续访问电脑版

kangle软件 是一款高性能跨平台web服务器

 找回密码
 注册
kangle web软件将启用新域名 kangleweb.com 作为kangle软件官方网站网址
kangle web服务器最新版下载
kangle访问控制模块介绍 -  kangle设置优化原则
kangle中文帮助手册 -产品购买
easypanel 虚拟主机控制面板最新版
easypanel虚拟主机控制面板功能列表
easypanel中文帮助手册 - 讨论
   kangle虚拟主机管理下载 - 安装 - 帮助手册
    
   销售: 在线客服QQ   技术支持: 在线客服QQ
    kangle web (介绍, 功能特性, 运行环境, 安装说明, 常见问题, 使用教程)     easypanel主机控制面板 (介绍, 功能特性, 安装说明, 常见问题, 使用教程)
    vhms系统 (介绍, 安装说明, 常见问题, 使用教程)     [kangle软件交流QQ群:104434948]
查看: 9242|回复: 16

easypanel API接口查询

[复制链接]
发表于 2015-11-30 15:57:40 | 显示全部楼层 |阅读模式
为方便大家对接easypanel,现将easypanel的对外接口逐一贴出,让有能力的人集成或开发出比vhms更好用的管理系统。
此贴只讨论api接口相关的问题。请勿灌水。
先开贴,有空的时候我会一个一个贴。
回复

使用道具 举报

 楼主| 发表于 2015-12-2 15:47:15 | 显示全部楼层
api接口地址
因easypanel自动绑定侦听了3312端口并加了泛绑定。
所以用IP或者解析到了服务器IP的域名都可以。
url如下:
  1. http://服务器IP地址(或域名):3312/api/index.php
复制代码





api接口权限验证
每发送一条api调用,必需带的参数有:
  1. c : (control)表示哪个控制文件(目前有whm,cdn)
  2. a : (action)表示哪个方法,以下介绍
  3. r : 随机数
  4. s : 秘钥,通过md5(a + skey +r)得到,如a=add,skey=test,r=888,则s=md5(addtest888)

  5. 其中skey是服务器安全码
复制代码

如:
  1. http://192.168.1.20:3312/api/index.php?c=whm&a=add&r=888&s=8e4fc6f181bedf11c64bac3bf341ca6a
复制代码


如果验证s不通过,你会得到以下的返回
  1. {"result":403,"msg":"\u6743\u9650\u9519\u8bef,\u8bf7\u68c0\u67e5\u901a\u4fe1\u5b89\u5168\u7801\u662f\u5426\u6b63\u786e"}
复制代码



接口的返回数据
如果接口加了json=1参数过来,你将得到json数据。如果没有,将得到xml数据。
友情提示:请最好带json=1参数过来。以后的接口默认情况下考虑输出json。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-2 16:04:08 | 显示全部楼层
spaceworld 发表于 2015-12-2 15:47
api接口地址
因easypanel自动绑定侦听了3312端口并加了泛绑定。
所以用IP或者解析到了服务器IP的域名都可以 ...


获取easypanel的信息(包括了kangle的信息)
c : whm
a : info
调用成功后你将得到如下返回数据:
  1. {"result":200,"server":[{"0":"kangle"}],"version":[{"0":"3.4.8"}],"type":[{"0":"enterprise"}],"os":[{"0":"windows"}],"license_id":[{"0":"73646_1387957818"}],"license_name":[{"0":"dsdds"}],"total_run":[{"0":"611038"}],"connect":[{"0":"4"}],"request":[{"0":"14105"}],"accept":[{"0":"4722"}],"vh":[{"0":"43"}],"kangle_home":[{"0":"D:\\\easypanel\\"}],"update_code":[{"0":"win_x64"}],"easypanel_version":"2.6.17"}
复制代码

其中result=200表示调用成功。
version是kangle的版本
type是kangle的商业版还是免费版(enterprise  or free)
total_run 是运行时间
vh 是虚拟主机数量
connect是当前有多少请求进来。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-2 16:09:36 | 显示全部楼层
spaceworld 发表于 2015-12-2 16:04
获取easypanel的信息(包括了kangle的信息)
c : whm
a : info


获取站点的信息
c : whm
a : getVh
name : (虚拟主机名称)
如果有这个站点,则返回:
  1. {"result":200,"name":"asdf","doc_root":"D:\/home\/ftp\/a\/asdf","uid":"a1017","gid":"K~w_dSjgZe9MVqb","module":"php","templete":"easypanel","subtemplete":null,"create_time":"1444195060","expire_time2":0,"status":0,"subdir_flag":"1","subdir":"wwwroot","web_quota":"1000","db_quota":"0","domain":"-1","htaccess":".htaccess","max_connect":"0","max_worker":"8","max_queue":"0","ftp":"1","log_file":"logs\/access.log","access":"access.xml","db_name":"asdf","speed_limit":"0","product_id":"0","envs":"","cs":0,"cdn":"0","ext_passwd":0,"db_type":"mysql","log_handle":"1","max_subdir":"0","flow":"0","sync_seq":0,"flow_limit":"0","ftp_connect":"0","ftp_usl":"0","ftp_dsl":"0","ip":"","port":"","certificate":null,"certificate_key":null,"ftp_subdir":null,"last_password_error":"'''0'''","password_error_count":"'''0'''","password_security":null,"ssi":"1","ignore_backup":"0","cron":"0","recordid":"10001"}
复制代码


如果没有该站点,返回
  1. {"result":500}
复制代码


虚拟主机的参数说明
name : 主机名称
doc_root:主机的主目录
uid:系统生成(用户在服务器上的账户ID),权限控制使用。不可更改。
gid :系统账户组ID
module:是属于哪个模块,目前有php和iis两个模块。
templete,subtemplete,已废弃
create_time :创建时间
expire_time2 :过期时间
status:站点状态,0正常,1为关闭。
subdir_flag 是否允许子域名,1为允许,0为不允许
subdir 默认子目录名称
web_quota 空间大小
db_quota 数据库大小
domain :允许绑定域名数量 -1为不限
max_connect 最多连接数
max_worker 最多工作者
ftp : 是否开通ftp,1为开通,0为不开通
db_name 数据库名称(一般和主机名称等同,sql server 特殊)

先到这。余下的稍后补
回复 支持 反对

使用道具 举报

发表于 2015-12-13 23:16:35 | 显示全部楼层
spaceworld 发表于 2015-12-2 16:09
获取站点的信息
c : whm
a : getVh

更新快点吗老大
回复 支持 反对

使用道具 举报

发表于 2015-12-15 10:38:31 | 显示全部楼层
更新快点吗老大
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-16 09:41:33 | 显示全部楼层
spaceworld 发表于 2015-12-2 16:09
获取站点的信息
c : whm
a : getVh

创建站点
固定参数:
  1. c : whm
  2. a : add_vh
  3. r : 随机
  4. s : 秘钥
  5. init : 1  //表示创建
  6. name:网站账号,数据库账号,ftp账号同步
  7. passwd:网站密码,数据库密码,ftp密码同步(只创建时同步)
复制代码

以下为可选参数(用于发送空间的一些参数,如网页大小,数据库大小,有三种方式,第一种是发送产品ID,第二种是发送产品名称,最后一种是发送详细的参数);
第一种:发送产品ID
  1. product_id:easypanel里的产品ID
复制代码

例:
  1. http://www.kanglesoft.com:3312/api/?c=whm&a=add_vh&r=3333&s=sdfasdfsadfddaffsdf3&name=webtest&passwd=webpasswd&init=1&product_id=1
复制代码

第二种:发送产品名称
  1. Product_name:easypanel里的产品名称
复制代码

例:
  1. http://www.kanglesoft.com:3312/api/?c=whm&a=add_vh&r=3333&s=sdfasdfsadfddaffsdf3&name=webtest&passwd=webpasswd&init=1&product_name=php100
复制代码

第三种:发送详细的参数:
  1. cdn:是否为CDN空间,是则发送1
  2. Templete:语言(html|php|iis)
  3. Subtemplete:语言引擎,php52|php53|php5217
  4. web_quota:网页空间大小,数字
  5. db_quota:数据库大小,数字
  6. db_type:数据库类型,mysql|sqlsrv
  7. subdir_flag:是否允许绑定子目录,1为是
  8. Subdir:默认绑定目录,可为空,例:wwwroot
  9. max_subdir:最多子目录数
  10. domain:需要绑定的域名,可空,默认会绑定到subdir指 定的目录下。
  11. ftp:是否开启ftp,1为是
  12. ftp_connect:ftp最多连接数
  13. ftp_usl:ftp上传速度限制,单位kb
  14. ftp_dsl:ftp下载限制。单位kb
  15. access:是否启用自定义控制,如果是请输入自定义控制文件名access.xml
  16. speed_limit:带宽限制,数字型,默认为不限
  17. log_handle:是否开启日志析分功能,1为是
  18. flow_limit:流量限制,数字型,默认不限
复制代码


回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-16 09:46:49 | 显示全部楼层
修改站点
固定参数:
  1. c : whm
  2. a : add_vh
  3. r : 随机
  4. s : 秘钥
  5. edit : 1  
  6. name:网站账号,数据库账号,ftp账号同步
  7. passwd:网站密码,数据库密码,ftp密码同步(只创建时同步)
复制代码

以下为可选参数(用于发送空间的一些参数,如网页大小,数据库大小,有三种方式,第一种是发送产品ID,第二种是发送产品名称,最后一种是发送详细的参数);
第一种:发送产品ID
  1. product_id:easypanel里的产品ID
复制代码

例:
  1. http://www.kanglesoft.com:3312/api/?c=whm&a=add_vh&r=3333&s=sdfasdfsadfddaffsdf3&name=webtest&passwd=webpasswd&edit=1&product_id=1
复制代码

第二种:发送产品名称
  1. Product_name:easypanel里的产品名称
复制代码

例:
  1. http://www.kanglesoft.com:3312/api/?c=whm&a=add_vh&r=3333&s=sdfasdfsadfddaffsdf3&name=webtest&passwd=webpasswd&edit=1&product_name=php100
复制代码

第三种:发送详细的参数:
  1. cdn:是否为CDN空间,是则发送1
  2. Templete:语言(html|php|iis)
  3. Subtemplete:语言引擎,php52|php53|php5217
  4. web_quota:网页空间大小,数字
  5. db_quota:数据库大小,数字
  6. db_type:数据库类型,mysql|sqlsrv
  7. subdir_flag:是否允许绑定子目录,1为是
  8. Subdir:默认绑定目录,可为空,例:wwwroot
  9. max_subdir:最多子目录数
  10. domain:需要绑定的域名,可空,默认会绑定到subdir指 定的目录下。
  11. ftp:是否开启ftp,1为是
  12. ftp_connect:ftp最多连接数
  13. ftp_usl:ftp上传速度限制,单位kb
  14. ftp_dsl:ftp下载限制。单位kb
  15. access:是否启用自定义控制,如果是请输入自定义控制文件名access.xml
  16. speed_limit:带宽限制,数字型,默认为不限
  17. log_handle:是否开启日志析分功能,1为是
  18. flow_limit:流量限制,数字型,默认不限
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-16 09:51:37 | 显示全部楼层
获取站点列表
a : whm
c : listVh
r : 随机数
s : 秘钥
返回样列数据(json)
  1. {"result":200,"rows":[{"name":"dnsdun","doc_root":"D:\\project\\dnsdun","uid":"a1001","module":"php","templete":"easypanel","subtemplete":null,"create_time":"1408332566","expire_time2":"'''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''","status":"0","subdir_flag":"1","subdir":"wwwroot","web_quota":"1000","db_quota":"1000","domain":"-1","htaccess":".htaccess","max_connect":"0","max_worker":"8","max_queue":"0","ftp":"0","log_file":"logs\/access.log","access":"access.xml","db_name":"dnsdun","speed_limit":"0","product_id":"0","envs":"","cs":"'''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''","cdn":"0","ext_passwd":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","db_type":"mysql","log_handle":"1","max_subdir":"0","flow":"0","sync_seq":"'''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''","flow_limit":"0","ftp_connect":"0","ftp_usl":"0","ftp_dsl":"0","ip":"","port":"","certificate":null,"certificate_key":null,"ftp_subdir":"","last_password_error":"'0'","password_error_count":"'0'","password_security":null,"ssi":"1","ignore_backup":"0","cron":"0","recordid":"10406"},{"name":"vhmshost","doc_root":"D:\/home\/ftp\/v\/vhmshost","uid":"a1011","module":"php","templete":"easypanel","subtemplete":null,"create_time":"1437731150","expire_time2":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","status":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","subdir_flag":"1","subdir":"wwwroot","web_quota":"1000","db_quota":"1000","domain":"-1","htaccess":".htaccess","max_connect":"0","max_worker":"8","max_queue":"0","ftp":"1","log_file":"logs\/access.log","access":"access.xml","db_name":"vhmshost","speed_limit":"0","product_id":"0","envs":"","cs":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","cdn":"0","ext_passwd":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","db_type":"mysql","log_handle":"1","max_subdir":"0","flow":"0","sync_seq":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","flow_limit":"0","ftp_connect":"0","ftp_usl":"0","ftp_dsl":"0","ip":"","port":"","certificate":null,"certificate_key":null,"ftp_subdir":null,"last_password_error":"'''0'''","password_error_count":"'''0'''","password_security":null,"ssi":"1","ignore_backup":"0","cron":"0","recordid":"10505"},{"name":"kangle","doc_root":"D:\/home\/ftp\/k\/kangle","uid":"a1012","module":"php","templete":"easypanel","subtemplete":null,"create_time":"1440134528","expire_time2":"1443014667.584","status":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","subdir_flag":"1","subdir":"wwwroot","web_quota":"1000","db_quota":"0","domain":"-1","htaccess":".htaccess","max_connect":"0","max_worker":"8","max_queue":"0","ftp":"1","log_file":"logs\/access.log","access":"access.xml","db_name":"kangle","speed_limit":"102400","product_id":"0","envs":"","cs":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","cdn":"0","ext_passwd":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","db_type":"mysql","log_handle":"1","max_subdir":"0","flow":"0","sync_seq":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","flow_limit":"0","ftp_connect":"0","ftp_usl":"0","ftp_dsl":"0","ip":"","port":"","certificate":null,"certificate_key":null,"ftp_subdir":null,"last_password_error":"'''0'''","password_error_count":"'''0'''","password_security":null,"ssi":"1","ignore_backup":"0","cron":"0","recordid":"10637"},{"name":"php100010","doc_root":"D:\/home\/ftp\/p\/php100010","uid":"a1013","module":"","templete":"php","subtemplete":"php52","create_time":"1441868079","expire_time2":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","status":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","subdir_flag":"1","subdir":"\/wwwroot","web_quota":"100","db_quota":"100","domain":"-1","htaccess":".htaccess","max_connect":"0","max_worker":"8","max_queue":"0","ftp":"1","log_file":"logs\/access.log","access":"access.xml","db_name":"php100010","speed_limit":"0","product_id":"10","envs":"","cs":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","cdn":"0","ext_passwd":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","db_type":"mysql","log_handle":"0","max_subdir":"0","flow":"0","sync_seq":"'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''0'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''","flow_limit":"0","ftp_connect":"0","ftp_usl":"0","ftp_dsl":"0","ip":"","port":"","certificate":null,"certificate_key":null,"ftp_subdir":null,"last_password_error":"'''0'''","password_error_count":"'''0'''","password_security":null,"ssi":"0","ignore_backup":"0","cron":"0","recordid":"10866"}]}
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-12-16 09:54:31 | 显示全部楼层
修改站点密码
c :whm
a : change_password
r : 随机数
s : 秘钥
name :站点名称
passwd :新的密码

例 :
  1. http://localhost:3312/api/index.php?c=whm&a=change_password&name=dnsdun&passwd=kangle&json=1
复制代码

返回成功:
  1. {"result":200}
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|Archiver|Bangteng Inc. ( 赣ICP备13005708号-5

GMT+8, 2017-12-13 07:23 , Processed in 0.059826 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表