Linkis provides access to WebSocket, and the frontend can interact with Link's WebSocket only in real time and does not need to be queried through Restful.
Linkis defines a set of its own interface norms when interacting at the back and back end.
If you are interested in interface specifications, please click hereto view interface norms
We provide the following interfaces to facilitate rapid user submission of Jobs for implementation.
This interface is intended to create a WebSocket connection with Linkis.
/api/res_j/entrance/connect
Request Method GET
Response status code 101
Requested task is to submit user's assignment to Linkis for execution interface
Interface /api/res_j/entrance/execution
Submit Method POST
Request JSON Example
{ "method":"/api/rest_j/v1/entrance/execute", "data":{ "params": { "variable":{ "k1":"v1" }, "configuration":{ "special":{ "k2":"v2" }, "runtime":{ "k3":"v3" }, "startup":{ "k4":"v4" } } }, "executeApplicationName":"spark", "executionCode":"show tables", "runType":"sql", "source":{ "scriptPath": "/home/Linkis/Linkis.sql" }, "websocketTag":"37fcbd8b762d465a0c870684a0261c6e" } }
| Parameter Name | Definition of parameters | Type | Remarks |
|---|---|---|---|
| executeApplicationName | Engine services such as Spark, hive, etc. the user expects to use | String | must not be empty |
| requestApplicationName | Name of system to launch the request | String | is empty |
| params | User-specified parameters for running the service program | Map | Required, the value inside is empty |
| Execution Code | Execution code submitted by user | String | must not be empty |
| runType | When users perform such services as spark, they can select python, R, SQL, etc. | String | must not be empty |
| scriptPath | Path to store for user submitted code scripts | String | If IDE, it cannot be empty with execution code |
{ "method": "/api/rest_j/v1/entrance/execute", "status": 0, "message": "The request was executed successfully", "data": { "execID": "030418IDEhivelocalhost010004:10087IDE_johnnwang_21", "taskID": "123" } }
Once executed, the server will take the initiative to push information about the status, logs, progress, etc. You can also use WebSocket to ask for status, logs, and progress.
Server has initiated the following content:
{ "method": "/api/rest_j/v1/entrance/${execID}/log", "status": 0, "message": "Return log information", "data": { "execID": "${execID}", "log": ["error","warn","info", "all"], "taskID":28594, "fromLine": 56 }, "websocketTag":"37fcbd8b762d465a0c870684a0261c6e" }
LOD "method": "/api/res_j/v1/entrance/${execID}/status", "status": 0, "message": "Return status information", "data": { "execID": "${execID}", "taskID":28594, "status": "Running", }, "websocketTag": "37fcbd8b762d465a0c860684a0261c6e" }
{ "method": "/api/rest_j/v1/entrance/${execID}/log", "status": 0, "message": "Return progress information", "data": { "execID": "${execID}", "taskID":28594, "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 } ] }, "websocketTag":"37fcbd8b762d465a0c870684a0261c6e" }