Skip to main content
Version: 1.0.3

Linkis Task submission and execution Rest API document

  • The return of the Linkis Restful interface follows the following standard return format:
{
"method": "",
"status": 0,
"message": "",
"data": {}
}

Convention:

  • method: Returns the requested Restful API URI, which is mainly used in WebSocket mode.
  • status: return status information, where: -1 means no login, 0 means success, 1 means error, 2 means verification failed, 3 means no access to the interface.
  • data: return specific data.
  • message: return the requested prompt message. If the status is not 0, the message returned is an error message, and the data may have a stack field, which returns specific stack information.

For more information about the Linkis Restful interface specification, please refer to: Linkis Restful Interface Specification

1. Submit for Execution

  • Interface /api/rest_j/v1/entrance/execute

  • Submission method POST

{
"executeApplicationName": "hive", //Engine type
"requestApplicationName": "dss", //Client service type
"executionCode": "show tables",
"params": {"variable": {}, "configuration": {}},
"runType": "hql", //The type of script to run
"source": {"scriptPath":"file:///tmp/hadoop/1.hql"}
}
  • Interface /api/rest_j/v1/entrance/submit

  • Submission method POST

{
"executionContent": {"code": "show tables", "runType": "sql"},
"params": {"variable": {}, "configuration": {}},
"source": {"scriptPath": "file:///mnt/bdp/hadoop/1.hql"},
"labels": {
"engineType": "spark-2.4.3",
"userCreator": "hadoop-IDE"
}
}

-Return to example

{
"method": "/api/rest_j/v1/entrance/execute",
"status": 0,
"message": "Request executed successfully",
"data": {
"execID": "030418IDEhivelocalhost010004:10087IDE_hadoop_21",
"taskID": "123"
}
}
  • execID is the unique identification execution ID generated for the task after the user task is submitted to Linkis. It is of type String. This ID is only useful when the task is running, similar to the concept of PID. The design of ExecID is (requestApplicationName length)(executeAppName length)(Instance length)${requestApplicationName}${executeApplicationName}${entranceInstance information ip+port}${requestApplicationName}_${umUser}_${index}

  • taskID is the unique ID that represents the task submitted by the user. This ID is generated by the database self-increment and is of Long type

2. Get Status

  • Interface /api/rest_j/v1/entrance/${execID}/status

  • Submission method GET

  • Return to example

{
"method": "/api/rest_j/v1/entrance/{execID}/status",
"status": 0,
"message": "Get status successful",
"data": {
"execID": "${execID}",
"status": "Running"
}
}

3. Get Logs

  • Interface /api/rest_j/v1/entrance/${execID}/log?fromLine=${fromLine}&size=${size}

  • Submission method GET

  • The request parameter fromLine refers to the number of lines from which to get, and size refers to the number of lines of logs that this request gets

  • Return example, where the returned fromLine needs to be used as a parameter for the next request of this interface

{
"method": "/api/rest_j/v1/entrance/${execID}/log",
"status": 0,
"message": "Return log information",
"data": {
"execID": "${execID}",
"log": ["error log","warn log","info log", "all log"],
"fromLine": 56
}
}

4. Get Progress

  • Interface /api/rest_j/v1/entrance/${execID}/progress

  • Submission method GET

  • Return to example

{
"method": "/api/rest_j/v1/entrance/{execID}/progress",
"status": 0,
"message": "Return progress information",
"data": {
"execID": "${execID}",
"progress": 0.2,
"progressInfo": [
{
"id": "job-1",
"succeedTasks": 2,
"failedTasks": 0,
"runningTasks": 5,
"totalTasks": 10
},
{
"id": "job-2",
"succeedTasks": 5,
"failedTasks": 0,
"runningTasks": 5,
"totalTasks": 10
}
]
}
}

5. Kill Task

  • Interface /api/rest_j/v1/entrance/${execID}/kill

  • Submission method POST

{
"method": "/api/rest_j/v1/entrance/{execID}/kill",
"status": 0,
"message": "OK",
"data": {
"execID":"${execID}"
}
}