-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
API Invoke Example
Naibo Wang edited this page May 26, 2023
·
16 revisions
如果想要通过API调用的方式获得任务执行ID,可以参考以下文件:
https://github.com/NaiboWang/EasySpider/blob/v0.3.1/ElectronJS/src/taskGrid/invokeTask.html
参考此文件的第237行开始的localExecuteInstant
方法的POST调用案例:
var para = {};
var t = $('#form').serializeArray();
t.forEach(function (item, index) {
para[item.name] = item.value;
});
$.post("http://localhost:8074/invokeTask", {
id: TASKID, //这里写任务ID号,如1
paras: JSON.stringify(para)
}, function (EID) {
console.log("任务ID为:", EID);
});
以上POST
请求将返回任务执行IDexecution_ID
,接下来使用命令行传入此ID即可执行任务。
后台处理逻辑在以下文件的第223行:
https://github.com/NaiboWang/EasySpider/blob/v0.3.1/ElectronJS/server.js
Click Pages
above to see more pages