八、任务接口

2019-06-08 18:20:19 george518 ...

考虑到在日常应用中会用到接口来进行管理定时任务,PPGo_Job v2.6版本开始提供三个简单的定时任务接口。

一、新增和修改任务接口

url:/task/apitask
method:post

params:

id:0
create_id:4
group_id:3
task_name:测试API创建任务
description:测试
concurrent:0
server_id:2
cron_spec:*/2 * * * *
command:free -G
timeout:0
is_notify:0
notify_type:0
notify_tpl_id:0
notify_user_ids:0

参数含义详见数据库字段。 需要注意的是id为0为新增,大于0为修改。

二、任务启动接口

url:/task/apistart
method:post

params:

id:11

三、任务暂停接口

url:/task/apipause
method:post

params:

id:11

注意使用 form-data的方式传参

返回值:

返回json,status=0表示成功,其他为失败,msg是错误理由或id

{
“message”: 11,
“status”: 0
}
具体可以使用postman测试

相似文章