This document introduces the APIs related to scheduled tasks provided by FineDataLink that can be called by Jiandaoyun, FineReport, and external systems.
1. The instance ID is the running record ID, which can be viewed under O&M Center > Scheduled Task > Running Record.
2. All API calls require authentication. Otherwise, an authentication failure message will be returned. The examples in this document use the built-in authentication methods of Open Platform for demonstration. For details about authentication methods, see Description of Calling APIs Related to Scheduled Tasks.
3. Only scheduled tasks running in Production Mode support API-based execution and termination.
Basic Information
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workId/records
Content-Type: application/json
Request method: POST
Request Parameter
1. Header parameter
client_id
Yes
String
The client_id parameter is required for API authentication using the AK/SK Direct Authentication method. Replace it with the one required by the actually used application authentication method.
secret
{{Secret key}}
The secret parameter is required for API authentication using the AK/SK Direct Authentication method. Replace it with the one required by the actually used application authentication method.
2. Body parameter
Request type: raw_json
{ "workId": "e10f1f1a-d567-4058-98bb-b71204154f8b", "latest": false, //Optional. Determine whether to query only the most recent execution. Options include true and false, which defaults to false if omitted. "startTime": "", //Optional. Enter the start time (unrestricted if omitted). "finishTime": "", //Optional. Enter the end time (unrestricted if omitted). "taskStatus": "SUCCESS", //Optional. Enter the task execution status (returns all if omitted). "triggerMethod": "MANUAL" //Optional. Enter the triggering method, including MANUAL and FIX_TIME (returns all if omitted).}
workId
Scheduled task ID
latest
false
No
Boolean
Optional. Determine whether to query only the most recent execution. Options include true and false, which defaults to false if omitted.
startTime
Optional. Enter the start time (unrestricted if omitted).
finishTime
Optional. Enter the end time (unrestricted if omitted).
taskStatus
Optional. Enter the task execution status.
SUCCESS: successful
ERROR: execution failed
BUILD_FAIL: construction failed
INTERRUPT: interrupted
RUNNING: running
QUEUING: queuing
BUILDING: constructing
triggerMethod
MANUAL
Optional. Enter the triggering method, including MANUAL and FIX_TIME (returns all if omitted).
Response Example
Success:
{ "status": 200, "data": { "executeIds": [ "7d5a4b14-f0de-47b8-91ad-a8777b76236c", "0d20a589-e66f-4b47-8256-e40e0252eea2", "24c6d78a-2d4f-40b5-b9fb-08eef1133612", "9fa0d375-89f4-425f-8e39-0c6de623637a", ] }}
200
Integer
data
Object
data.executeIds
7d5a4b14-f0de-47b8-91ad-a8777b76236c
Array
The value is a list of instance IDs, which are the running record IDs.
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workName/records
${Application ID}
{ "workName": "fdlDemo, //Required. Enter the task name. "latest": true, //Optional. Determine whether to query only the most recent execution. Options include true and false, which defaults to false if omitted. "startTime": "", //Optional. Enter the start time (unrestricted if omitted). "finishTime": "", //Optional. Enter the end time (unrestricted if omitted). "taskStatus": "SUCCESS", //Optional. Enter the task execution status (returns all if omitted). "triggerMethod": "FIX_TIME" //Optional. Enter the triggering method, including MANUAL and FIX_TIME (returns all if omitted).}
workName
fdlDemo
Required. Enter the task name.
true
SUCCESS
FIX_TIME
1. Success
{"status": 200,"data": {"executeIds": ["40fc80c6-ac03-4943-b6d7-e79ff5cca581"]}}
status
40fc80c6-ac03-4943-b6d7-e79ff5cca581
The value is the instance ID list.
2. Failure
{"status": 200,"errorCode": "E8130031","errorMsg": "The task does not exist. The file cannot be obtained."}
errorCode
E8130031
errorMsg
The task does not exist. The file cannot be obtained.
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/record/info?recordId=
Request method: GET
Query parameter:
recordId
16f7f568-767f-4786-bb2c-5dbc64cfbcad
{ "status": 200, "data": { "recordId": "16f7f568-767f-4786-bb2c-5dbc64cfbcad", //Execution instance ID "taskId": "868478d9-a36d-481f-b42d-6074310c2829", //Task ID "taskName": "fdlDemo", //Task name "taskPath": "Task List/Level 1 Directory/fdlDemo", //Task path "status": "INTERRUPT", //Instance execution status "startTime": 1690786927020, //Execution start time of the instance "finishTime": 1690786944299, //Execution end time of the instance "triggerMethod": "MANUAL", //Instance triggering method. "triggerBy": "root" //User who triggered the instance execution}}
data.recordId
The value is the instance ID, which is the running record ID.
data.taskId
868478d9-a36d-481f-b42d-6074310c2829
Task ID
data.taskName
Task name
data.taskPath
Task List/First-Level Directory/fdlDemo
Task path
data.status
INTERRUPT
Instance execution status
data.startTime
1690786927020
Execution start time of the instance
data.finishTime
1690786944299
Execution end time of the instance
data.triggerMethod
Instance triggering method
data.triggerBy
root
The user who triggered the instance execution
{"status": 200,"errorCode": "E8130012","errorMsg": "can not find record by recordId"}
E8130011
can not find record by recordId
3. Permission dissatisfaction
{"status": 200,"errorCode": "E8130011","errorMsg": "You have no permission."}
You have no permission.
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workId/execute
{ "workId": "e10f1f1a-d567-4058-98bb-b71204154f8b", "params": { "paramName": "paramValue" }, "waitForResponse": false, "waitTime": 10000}
{ "workId": "e10f1f1a-d567-4058-98bb-b71204154f8b", "params": {}}
e10f1f1a-d567-4058-98bb-b71204154f8b
Required. Enter the task ID.
params
Optional. Enter the parameter.
You can pass parameters to the scheduled task. For details, see Examples of Calling Scheduled Task APIs in FineReport Templates.
params.paramName
paramValue
waitForResponse
Optional. Determine whether to return the result after task completion. Values include true and false, which defaults to false if omitted. If you enter false, it returns the instance ID or the request result immediately. If you enter true, it returns the actual execution result.
waitTime
10000
Optional. Enter the wait time (unit: millisecond). The default value is 60000.
{"status": 200,"data": {"recordId": "70aa0661-c626-4c55-bbba-e392624945fa", //Instance ID"status": "SUCCESS" //Instance execution status}}
70aa0661-c626-4c55-bbba-e392624945fa
Instance ID
The instance ID is the running record ID.
This parameter value is returned only when the waitForResponse value is set to true.
Instance execution results include:
{"status": 200,"errorCode": "E8130051","errorMsg": "The task does not exist. The file cannot be obtained."}
E8130051
3. Null values for required fields
{"status": 200,"errorCode": "E8130052","errorMsg": "workId can not be null!"}
E8130052
workId can not be null!
4. Permission dissatisfaction
{"status": 200,"errorCode": "E8130059","errorMsg": "You have no permission."}
E8130059
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workName/execute
{"workName": "fdlDemo", //Required. Enter the task name. "params": {"paramName": "paramValue" //Optional. Enter the parameter. Leave it empty if there is no parameter.}, //Optional. Enter the parameter. "waitForResponse": "true", //Optional. Determine whether to return the result after task completion. "waitTime": 10000 }
{"workName": "Row-to-Column Conversion","params": {"paramName": ""}}
timeout
{"status": 200, "data": {"recordId": "e14169b9-328c-4b62-8a75-abc546f61d38", "status": "SUCCESS" } }
e14169b9-328c-4b62-8a75-abc546f61d38
{"status": 200, "errorCode": "E8130061", "errorMsg": "The task does not exist. The file cannot be obtained."}
E8130061
{"status": 200,"errorCode": "E8130061","errorMsg": "workName can not be null!"}
workName can not be null!
{"status": 200,"errorCode": "E8130069","errorMsg": "You have no permission."}
E8130069
It does not check whether the instance is currently running. If you call it to terminate an instance, any queued instances will also be terminated.
A successful request does not guarantee immediate termination, as the process may experience some delay.
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workId/terminate?workId=e10f1f1a-d567-4058-98bb-b71204154f8b
2. Query parameter:
{"code": "200","message": "success"}
code
message
success
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/workName/terminate?workName=01 Data Synchronization
01 Data Synchronization
{"code": "200","data": "success"}
{"status": 200, "errorCode": "E8130089", "errorMsg": "Task does not exist, unable to retrieve file" }
E8130089
API URL: http://IP address:Port number/webroot/decision/sp/client/api/fdl/records/terminate
{"executeIds": ["16f7f568-767f-4786-bb2c-5dbc64cfbcad222"] //Required. Enter the instance ID.}
executeIds
Required. Enter the instance ID.
{"status": 200,"data": "success"}
{"status": 200,"errorCode": "E8130042","errorMsg": "executeIds can not be null!"}
E8130042
executeIds can not be null!
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy