- Auth
- Tree
- Server >- Deploy Server >- Modify Server >- Get Server >- Get Server List >- Get Inactive Server List >- Get Server Notify Log List >- Get server realtime state >- Load Server >- Pre Expend >- Expand >- Add Adapter >- Delete Adapter >- Modify Adapter >- Get Adapter >- * Get Adapter List
- Server Config >- Add Config >- Delete Config >- Modify Config >- Get Config >- Get Config List >- Get Node Config List >- Get Config Modify List >- Get Config Modify content >- Add Ref >- Delete Ref >- Ref List >- Merge Node Config >- * Push Config
- Task Manage >- Add Task >- Get Task and Sub Task Info >- * Get Task List
- Publish Package >- Upload Package >- Upload And Publish >- * Get Publish Version list
- Template >- Add Template >- Delete Template >- Modify Template >- Get Template >- * Query Template
- Monitor >- Get tarsstat Monitor Data >- Get tarsproperty monitor data
- Dict >- Get Server Type List >- Get Template List >- * Select Server
- Resource >- Install Tars Node >- Uninstall Tars Node
- Other >- Send Custom Command to Server >- Get Unused Port
Please use web>=2.0.0.
Create a new token in the user center, and use the web API after obtaining the token
The usage of Web API is as follows:
http://xx.xx.xx.xx/api/[command]?ticket=[token]
Ticket: token generated in Web Platform
/api/tree
Get Application Tree
None
{
"id": "", // Node ID
"name": "", // Node Name
"pid": "", // Parent Node ID
"open": true, // Expand
"is_parent": true, // Is Parent Node
"children": [] // Children
}
/api/deploy_server
{
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"template_name": "", // Template Name
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"adapters": [{
"obj_name": "", // OBJ Name
"bind_ip": "", // Obj Bind IP
"port": "", // Port
"port_type": "tcp", // Port Type
"protocol": "tars", // Protocol
"thread_num": 0, // Thread Num
"max_connections": 0, // Max Connections
"queuecap": 0, // Max length
"queuetimeout": 0 // Timeout in Queue
}]
}
{
"server_conf": { //Server Info
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version", "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
},
"tars_node_rst":[ //tarsnode install result
{
"ip":"1.1.1.3", //Machine IP
"rst":false,//install tarsnode
"msg":""
}
]
}
Only Support POST method,in Header set Content-Type:application/json
/api/update_server
{
"id": 0, // Server ID
"isBak": true, // Is Backup Machine
"template_name": "", // Template Name
"server_type": "", // Server Type
"enable_set": "", // Open Set
"set_name": "", // Set Name
"ser_area": "", // Set Region
"set_group": "", // Set Group
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "",// Monitor Script
"profile": "" // Private Template
}
{
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version", "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
}
Only Support POST method,in Header set Content-Type:application/json
/api/server
id // Server ID
{
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version", "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
}
/api/server_list
tree_node_id // tree ID
[{
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version": "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
}]
/api/inactive_server_list
application // Application
server_name // Server Name
node_name // Node Name
[{
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version": "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
}]
/api/server_notify_list
tree_node_id // Tree ID
{
"count": 0,
"rows":[{
"notifytime": "", // Time
"server_id": "", // Server ID
"thread_id": "", // Thread ID
"command": "", // Command
"result": "" // 结果
}]
}
yes
/api/get_realtime_state
id // Server ID
{
"realtime_state": "" // realtime state
}
/api/load_server
application // Application
server_name // Server Name
node_name // Node Name
"" // Execute result
/api/expand_server_preview
{
"application": "", // Application
"server_name": "", // Server Name
"set": "", // Set
"node_name": "", // Node Name
"expand_nodes": [""], // Expand Node
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"copy_node_config": true // If copy node config when node_name is not empty
}
[{
"application": "", // Application
"server_name": "", // Server Name
"set": "", // Set
"obj_name": "", // OBJ Name
"node_name": "", // Node Name
"bind_ip": "", // Obj Bind IP
"port": 0, // Port
"template_name": "", // Template Name
"status": "", // 状态
}]
Only Support POST method,in Header set Content-Type:application/json
/api/expand_server
{
"application": "", // Application
"server_name": "", // Server Name
"set": "", // Set
"node_name": "", // Node Name
"copy_node_config": true, // If copy node config, when node_name is not empty
"expand_preview_servers": [{
"node_name": "", // Node Name
"set": "", // Set
"obj_name": "", // OBJ Name
"bind_ip": "", // Obj Bind IP
"port": 0 // Port
}]
}
{
"server_conf": { //Server Info
[{
"id": 0, // Server ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"server_type": "", // Server Type
"enable_set": true, // Open Set
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"setting_state": "", // Set State
"present_state": "", // Current State
"bak_flag": true, // Is Backup Machine
"template_name": "", // Template Name
"profile": "", // Private Template
"async_thread_num": 0, // Async Thread Num
"base_path": "", // Default Path
"exe_path": "", // EXE Path
"start_script_path": "", // Start Script
"stop_script_path": "", // Stop Script
"monitor_script_path": "", // Monitor Script
"patch_time": "", // Publish Time
"patch_version", "", // Publish Version
"process_id": "", // ProcessID
"posttime": "" // Update Time
}]
},
"tars_node_rst":[ //tarsnode install result
{
"ip":"1.1.1.3", //Machine IP
"rst":false,// install tarsnode result
"msg":""
}
]
}
Only Support POST method,in Header set Content-Type:application/json
/api/add_adapter_conf
{
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connect'o'n's
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"protocol": "", // Protocol
"handlegroup": "" // Handle Group(not use)
}
{
"id": 0, // Adapter ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"adapter_name": "", // Adapter Name
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connections
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"posttime": "", // Update Time
"protocol": "", // Protocol
"handlegroup": "" // Handle Group(not use)
}
Only Support POST method,in Header set Content-Type:application/json
/api/delete_adapter_conf
id // Adapter ID
[0] // Deleted Adapter ID
/api/update_adapter_conf
{
"id": 0, // Adapter ID
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connections
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"protocol": "", // Protocol
"handlegroup": "" // handle Group (not use)
}
{
"id": 0, // Adapter ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"adapter_name": "", // Adapter Name
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connections
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"posttime": "", // Update Time
"protocol": "", // Protocol
"handlegroup": "" // 处理组
}
Only Support POST method,in Header set Content-Type:application/json
/api/adapter_conf
id // Adapter ID
{
"id": 0, // Adapter ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"adapter_name": "", // Adapter Name
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connections
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"posttime": "", // Update Time
"protocol": "", // Protocol
"handlegroup": "" // handle group(not use)
}
/api/adapter_conf_list
id // Server ID
[{
"id": 0, // Adapter ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"adapter_name": "", // Adapter Name
"thread_num": 1, // Thread Num
"endpoint": "", // EndPoint
"max_connections": 0, // Max Connections
"allow_ip": "", // Allow IP
"servant": "", // Servant
"queuecap": 0, // Queue Length
"queuetimeout": 0, // Timeout in Queue
"posttime": "", // Update Time
"protocol": "", // Protocol
"handlegroup": "" // 处理组
}]
/api/add_config_file
{
"level": 1, // Level
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set取
"set_group": "", // Set Group
"filename": "", // File Name
"config": "" // Content
}
{
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set取
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application or Set,2:Server,3:节点
"posttime": "", // Update Time
}
/api/delete_config_file
id // ConfigID
[0] // Delete ConfigID
/api/update_config_file
{
"id": 0, // ConfigID
"config": "", // Content
"reason": "" // About
}
{
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application or Set,2:Server,3:Node
"posttime": "", // Update Time
}
Only Support POST method,in Header set Content-Type:application/json
/api/config_file
id // ConfigID
{
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application or Set,2:Server,3:Node
"posttime": "", // Update Time
}
/api/config_file_list
level // Level,1:Application,2:Set Name,3:Set Region,4:Set Group,5:Server
application // Application
server_name // Server Name
set_name // Set Name
set_area // Set Region
set_group // Set Group
[{
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set取
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application Or Set,2:Server,3:Node
"posttime": "", // Update Time
}]
/api/node_config_file_list
application // Application
server_name // Server Name
set_name // Set Name
set_area // Set Region
set_group // Set Group
config_id // ConfigID
[{
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set Region
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application or Set,2:Server,3:Node
"posttime": "", // Update Time
}]
Only Support POST method,in Header set Content-Type:application/json
/api/config_file_history
id // ID
{
"id": "", // ID
"config_id": "", // ConfigID
"reason": "", // About
"content": "", // content
"posttime": "", // Update Time
}
/api/config_file_history_list
config_id // ConfigID
{
"count":0,
"rows":[{
"id": "", // ID
"config_id": "", // ConfigID
"reason": "", // About
"content": "", // Content
"posttime": "", // Update Time
}]
}
yes
/api/add_config_ref
config_id // ConfigID
reference_id // ref ConfigID
{
"id": "", // ref ID
"config_id": "", // ConfigID
"reference_id": "" // ref ConfigID
}
/api/delete_config_ref
id // Ref ID
[0] // Deleted Ref ID
/api/config_ref_list
config_id // ConfigID
[{
"id": 0, // refID
"config_id": 0, // ConfigID
"reference": {
"id": 0, // ConfigID
"server_name": "", // Server Name
"node_name": "", // Node Name
"set_name": "", // Set Name
"set_area": "", // Set取
"set_group": "", // Set Group
"filename": "", // File Name
"config": "", // Content
"level": 1, // Level,1:Application or Set,2:Server,3:Node
"posttime": "", // Update Time
}
}]
/api/merged_node_config
id // Config ID
"" // Config content
/api/push_config_file
ids // config ID, sep by ;
[{
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"ret_code": 0, // Execute Result,0: Succ
"err_msg": "" // Error Message
}]
Include Start, Stop, Publish, Offline
/api/add_task
{
"serial": true, // Is Serial
"items": [{
"server_id": "", // Server Name
"command": "", // Command
"parameters": { // Parameter
}
}]
}
Command Include: restart,stop,undeploy_tars,patch_tars
when command!=patch_tars时,parameter is empty
when command=patch_tars时,parameter:
{
patch_id: "0", // Version
update_text: "", // About
bak_flag: true // backup flag, true:backup,false:master
}
"" // Task ID
Only support POST,http Header set: Content-Type:application/json
/api/task
task_no // Task ID
{
"task_no": "", // Task ID
"serial": true, // Is Serial
"status": 0, // Job State
"items":[{
"task_no": "",
"item_no": "", // Sub Job ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"command": "", // Command
"parameters": {}, // Parameter
"start_time": "", // Start Time
"end_time": "", // End Time
"status": "", // Sub Job State
"status_info": "", // State
"execute_info": "" // Execute Info
}]
}
/api/task_list
application // Application
server_name // Server Name
command // Command
from // Start Time
to // End Time
[{
"task_no": "", // Task ID
"serial": true, // Is Serial
"status": 0, // Job State
"items":[{
"task_no": "",
"item_no": "", // Sub Job ID
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"command": "", // Command
"parameters": {}, // Parameter
"start_time": "", // Start Time
"end_time": "", // End Time
"status": "", // Sub Job State
"status_info": "", // State
"execute_info": "" // Execute Info
}]
}]
/api/upload_patch_package
application // Application
module_name // Module Name
comment // About
suse // Packge OS name(not use)
task_id // task ID
md5 // package md5(empty not check)
{
"id": 0, // package ID
"server": "", // Server,Application+Module Name
"tgz": "", // Package name
"comment": "", // About
"posttime": "" // Update Time
}
/api/upload_and_publish
application // app
module_name // name
comment // comment
suse // file
msg
curl http://${TARS_WEB_HOST}/api/upload_and_publish?ticket=${TARS_TOKEN} -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${ServerName} -Fcomment=developer-auto-upload
/api/server_patch_list
application // Application
module_name // Module Name
{
"count":0,
"rows":[{
"id": 0, // PackageID
"server": "", // Server,Application+Module Name
"tgz": "", // Package name
"comment": "", // About
"posttime": "" // Update Time
}]
}
Yes
/api/add_profile_template
{
"template_name": "", // Not Empty,Template Name
"parents_name": "", // Not Empty,Parent Template
"profile": "" // Not Empty,Template Content
}
{
"id": 0, // Template ID
"template_name": "", // Template Name
"parents_name": "", // Parent Template
"profile": "", // Template Content
"posttime": "" // Update Time
}
/api/delete_profile_template
id // Template ID
[0] // Delete Template
/api/update_profile_template
{
"id": "", // Not Empty,Template ID
"template_name": "", // Not Empty,Template Name
"parents_name": "", // Not Empty,Parent Template
"profile": "" // Not Empty,Template Content
}
{
"id": 0, // Template ID
"template_name": "", // Template Name
"parents_name": "", // Parent Template
"profile": "", // Template Content
"posttime": "" // Update Time
}
/api/profile_template
template_name // Template Name
{
"id": 0, // Template ID
"template_name": "", // Template Name
"parents_name": "", // Parent Template
"profile": "", // Template Content
"posttime": "" // Update Time
}
/api/query_profile_template
template_name // Template Name
parents_name // Parent Template Name
[{
"id": 0, // Template ID
"template_name": "", // Template Name
"parents_name": "", // Parent Template
"profile": "", // Template Content
"posttime": "" // Update Time
}]
/api/tarsstat_monitor_data
thedate // Show Time
predate // Compare Time
startshowtime // Start Time
endshowtime // End Time
master_name // Server
slave_name // Client
interface_name // Interface
master_ip // ServerIP
slave_ip // ClientIP
group_by // Group
[{
"show_date": "", // Date
"show_time": "", // Time
"master_name": "", // Server
"slave_name": "", // Client
"interface_name": "", // Interface
"master_ip": "", // ServerIP
"slave_ip": "", // ClientIP
"the_total_count": "", // Current Date count
"pre_total_count": "", // Compare Date count
"total_count_wave": "", // wave rate
"the_avg_time": "", // Curent Date cost
"pre_avg_time": "", // Compare date cost
"the_fail_rate": "", // Current Date fail rate
"pre_fail_rate": "", // Compare Date fail rate
"the_timeout_rate": "", // Current Date timeout rate
"pre_timeout_rate": "" // Compare Date timeout rate
}]
/api/tarsproperty_monitor_data
thedate // Show Time
predate // Compare Time
startshowtime // Start Time
endshowtime // End Time
master_name // Server Name
master_ip // IP
property_name // property
policy // policy
[{
"show_date": "", // Date
"show_time": "", // Time
"master_name": "", // Server Name
"master_ip": "", // IP
"property_name": "", // property
"policy": "", // policy
"the_value": "", // Current Date Value
"pre_value": "" // Compare Date Value
}]
/api/server_type_list
None
["tars_cpp"]
/api/template_name_list
None
["tars.default"]
/api/cascade_select_server
level // Level,1:Application,2:Server Name,3:Set,4:Node
application // Application,level>1 Not Empty
server_name // Server Name,level>2 Not Empty
set // Set,level>3,:Set Name.Set Region.Set Group
[""] server list
/server/api/install_tars_node
ips //tarsnode machine ip
[
{
"ip": "",
"rst": true,
"msg":""
}
]
/api/uninstall_tars_node
ips //tarsnode machine ip
[
{
"ip": "", //机器IP
"rst": true, //卸载结果
"msg":"" //卸载结果信息
}
]
/api/send_command
server_ids // Server ID
command // Command
[{
"application": "", // Application
"server_name": "", // Server Name
"node_name": "", // Node Name
"ret_code": "", // Return Value
"err_msg": "" // err message
}]
/api/auto_port
node_name // Machine IP,sep by ;
[{
"node_name": "", //Machine IP
"port": "", // Port
}]