RESTful APIs and Clients

REST API v1

师成师成· 更新于 2026-09-29· 阅读 43 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Note that: now the api version is v1 and the base uri is /api/v1.

Session Resource

GET /sessions

Get the list of all live sessions

Response Body

NameDescriptionType
identifierThe session identifierString
userThe user name that created the sessionString
ipAddrThe client IP address that created the sessionString
confThe configuration of the sessionMap
createTimeThe session that created at this timestampLong
durationThe interval that last access time subtract created timeLong
idleTimeThe interval of no operationLong

GET /sessions/${sessionHandle}

Get a session event

Response Body

The KyuubiSessionEvent.

GET /sessions/${sessionHandle}/info/${infoType}

Get an information detail of a session

Request Parameters

NameDescriptionType
infoTypeThe id of Hive Thrift GetInfoInt

Response Body

NameDescriptionType
infoTypeThe type of session informationString
infoValueThe value of session informationString

GET /sessions/count

Get the current open session count

Response Body

NameDescriptionType
openSessionCountThe count of opening sessionInt

GET /sessions/execPool/statistic

Get statistic info of background executors

Response Body

NameDescriptionType
execPoolSizeThe current number of threads in the poolInt
execPoolActiveCountThe approximate number of threads that are actively executing tasksInt

POST /sessions

Create a session

Request Parameters

NameDescriptionType
configsThe configuration of the sessionMap

Response Body

NameDescriptionType
identifierThe session handle identifierString
kyuubiInstanceThe Kyuubi instance that holds the session and to call for the following operations in the sessionString

DELETE /sessions/${sessionHandle}

Close a session.

POST /sessions/${sessionHandle}/operations/statement

Create an operation with EXECUTE_STATEMENT type

Request Body

NameDescriptionType
statementThe SQL statement that you executeString
runAsyncThe flag indicates whether the query runs synchronously or notBoolean
queryTimeoutThe interval of query time outLong
confOverlayThe conf to overlay only for current operationMap of key=val

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/typeInfo

Create an operation with GET_TYPE_INFO type

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/catalogs

Create an operation with GET_CATALOGS type

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/schemas

Create an operation with GET_SCHEMAS type

Request Body

NameDescriptionType
catalogNameThe catalog nameString
schemaNameThe schema nameString

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/tables

Request Body

NameDescriptionType
catalogNameThe catalog nameString
schemaNameThe schema nameString
tableNameThe table nameString
tableTypesThe type of table, for example: TABLE or VIEWString

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/tableTypes

Request Parameters

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/columns

Request Body

NameDescriptionType
catalogNameThe catalog nameString
schemaNameThe schema nameString
tableNameThe table nameString
columnNameThe column nameString

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/functions

Request Body

NameDescriptionType
catalogNameThe catalog nameString
schemaNameThe schema nameString
functionNameThe function nameString

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/primaryKeys

Request Parameters

NameDescriptionType
catalogNameThe catalog nameString
schemaNameThe schema nameString
tableNameThe table nameString

Response Body

NameDescriptionType
identifierThe identifier of operationString

POST /sessions/${sessionHandle}/operations/crossReference

NameDescriptionType
identifierThe identifier of operationString

Request Body

NameDescriptionType
primaryCatalogThe primary catalog nameString
primarySchemaThe primary schema nameString
primaryTableThe primary table nameString
foreignCatalogThe foreign catalog nameString
foreignSchemaThe foreign schema nameString
foreignTableThe foreign table nameString

Response Body

NameDescriptionType
identifierThe identifier of operationString

Operation Resource

GET /operations/${operationHandle}/event

Get the current event of the operation by the specified operation handle.

Response Body

The KyuubiOperationEvent.

PUT /operations/${operationHandle}

Perform an action to the pending or running operation.

Request Body

Name Description Type

action The action that is performed to the operation. Currently, supported actions are 'cancel' and 'close'.

  • Cancel: to cancel the operation, which means the operation and its corresponding background task will be stopped, and its state will be switched to CANCELED. A CANCELED operation's status can still be fetched by client requests.
  • Close: to close the operation, which means the operation and its corresponding background task will be stopped, and its state will be switched to CLOSED. A CLOSED operation's status will be removed on the server side and can not be fetched anymore.

String

GET /operations/${operationHandle}/resultsetmetadata

Get the result set schema of the operation by the specified operation handle.

Response Body

NameDescriptionType
columnsThe descriptions of columnsList of ColumnDesc

GET /operations/${operationHandle}/log

Get a list of operation log lines of the running operation by the specified operation handle.

Request Parameters

NameDescriptionType
maxrowsThe max row that are pulled each timeInt

Response Body

NameDescriptionType
logRowSetThe set of log setList of Strings
rowCountThe count of log row setInt

GET /operations/${operationHandle}/rowset

Get the operation result as a list of rows by the specified operation handle.

Request Parameters

NameDescriptionType
maxrowsThe max rows that are pulled each timeInt
fetchorientationThe orientation of fetch, for example FETCH_NEXT, FETCH_PRIOR, FETCH_FIRST, FETCH_LAST, FETCH_RELATIVE, FETCH_ABSOLUTEString

Response Body

NameDescriptionType
rowsThe list of rowsList of Rows
rowCountThe count of rowsInt

Batch Resource

GET /batches

Returns all the batches.

Request Parameters

Name Description Type

batchType The batch type, such as spark/flink, if no batchType is specified,
return all types String

batchState The valid batch state can be one of the following:
PENDING, RUNNING, FINISHED, ERROR, CANCELED String

batchUser The user name that created the batch String

createTime Return the batch that created after this timestamp Long

endTime Return the batch that ended before this timestamp Long

from The start index to fetch batches Int

size Number of batches to fetch, 100 by default Int

Response Body

NameDescriptionType
fromThe start index of fetched batchesInt
totalNumber of batches fetchedInt
batchesBatch ListList

POST /batches

Create a new batch.

Request Body

  • Media type: application-json
  • JSON structure:
NameDescriptionType
batchTypeThe batch type, such as Spark, FlinkString
resourceThe resource containing the application to executePath (required)
classNameApplication main classString(required)
nameThe name of this batch.String
confConfiguration propertiesMap of key=val
argsCommand line arguments for the applicationList of Strings

Response Body

The created Batch object.

POST /batches (with uploading resource)

Create a new batch with uploading resource file.

Example of using curl command to send POST request to /v1/batches in multipart-formdata media type with uploading resource file from local path.

curl --location --request POST 'http://localhost:10099/api/v1/batches' \
--form 'batchRequest="{\"batchType\":\"SPARK\",\"className\":\"org.apache.spark.examples.SparkPi\",\"name\":\"Spark Pi\"}";type=application/json' \
--form 'resourceFile=@"/local_path/example.jar"'

Request Body

  • Media type: multipart-formdata
  • Request body structure in multiparts:
NameDescriptionMedia Type
batchRequestThe batch request in JSON format as request body requried in POST /batchesapplication/json
resourceFileThe resource to upload and execute, which will be cached on server and cleaned up after executionFile

Response Body

The created Batch object.

GET /batches/${batchId}

Returns the batch information.

Response Body

The Batch.

DELETE /batches/${batchId}

Kill the batch if it is still running.

Response Body

NameDescriptionType
successWhether killed the batch successfullyBoolean
msgThe kill batch messageString

GET /batches/${batchId}/localLog

Gets the local log lines from this batch.

Request Parameters

NameDescriptionType
fromOffsetInt
sizeMax number of log lines to return, 100 by defaultInt

Response Body

NameDescriptionType
logRowSetThe log linesList of Strings
rowCountThe log row countInt

Admin Resource

POST /admin/refresh/hadoop_conf

Refresh the Hadoop configurations of the Kyuubi server.

POST /admin/refresh/user_defaults_conf

Refresh the user defaults configs with key in format in the form of ___{username}___.{config key} from default property file.

POST /admin/refresh/kubernetes_conf

Refresh the kubernetes configs with key prefixed with kyuubi.kubernetes from default property file.

It is helpful if you need to support multiple kubernetes contexts and namespaces, see KYUUBI devlive-community/knowforge#4843.

DELETE /admin/engine

Delete the specified engine.

Request Parameters

NameDescriptionType
typethe engine typeString(optional)
sharelevelthe engine share levelString(optional)
subdomainthe engine subdomainString(optional)
proxyUserthe proxy user to impersonateString(optional)
hive.server2.proxy.userthe proxy user to impersonateString(optional)

proxyUser is an alternative to hive.server2.proxy.user, and the current behavior is consistent with hive.server2.proxy.user. When both parameters are set, proxyUser takes precedence.

GET /admin/engine

Get a list of satisfied engines.

Request Parameters

NameDescriptionType
typethe engine typeString(optional)
sharelevelthe engine share levelString(optional)
subdomainthe engine subdomainString(optional)
proxyUserthe proxy user to impersonateString(optional)
hive.server2.proxy.userthe proxy user to impersonateString(optional)

proxyUser is an alternative to hive.server2.proxy.user, and the current behavior is consistent with hive.server2.proxy.user. When both parameters are set, proxyUser takes precedence.

Response Body

The Engine List.

REST Objects

Batch

NameDescriptionType
idThe batch idString
userThe user created the batchString
batchTypeThe batch typeString
nameThe batch nameString
appStartTimeThe batch application start timeLong
appIdThe batch application IdString
appUrlThe batch application tracking urlString
appStateThe batch application stateString
appDiagnosticThe batch application diagnosticString
kyuubiInstanceThe kyuubi instance that created the batchString
stateThe kyuubi batch operation stateString
createTimeThe batch create timeLong
endTimeThe batch end time, if it has not been terminated, the value is 0Long

KyuubiSessionEvent

NameDescriptionType
sessionIdThe session idString
clientVersionThe client versionInt
sessionTypeThe session typeString
sessionNameThe session name, if user not specify it, we use empty string insteadString
userThe session user nameString
clientIPThe client ip addressString
serverIPA unique Kyuubi server id, e.g. kyuubi server ip address and port, it is useful if has multi-instance Kyuubi ServerString
confThe session configMap
startTimeThe session create timeLong
remoteSessionIdThe remote engine session idString
engineIdThe engine id. For engine on yarn, it is applicationIdString
openedTimeThe session opened timeLong
endTimeThe session end timeLong
totalOperationsHow many queries and meta callsInt
exceptionThe session exception, such as the exception that occur when opening sessionThrowable
eventTypeThe type of session eventString

KyuubiOperationEvent

NameDescriptionType
statementIdThe unique identifier of a single operationString
remoteIdThe unique identifier of a single operation at engine sideString
statementThe sql that you executeString
shouldRunAsyncThe flag indicating whether the query runs synchronously or notBoolean
stateThe current operation stateString
eventTimeThe time when the event created & loggedLong
createTimeThe time for changing to the current operation stateLong
startTimeThe time the query start to time of this operationLong
completeTimeTime time the query endsLong
exceptionCaught exception if haveThrowable
sessionIdThe identifier of the parent sessionString
sessionUserThe authenticated client userString

ColumnDesc

NameDescriptionType
columnNameThe name of the columnString
dataTypeThe type descriptor for this columnString
columnIndexThe index of this column in the schemaInt
precisionThe precision of the columnInt
scaleThe scale of the columnInt
commentThe comment of the columnString

Row

NameDescriptionType
fieldsThe fields of rowList of Fields

Field

NameDescriptionType
dataTypeThe type of columnString
valueThe value of columnObject

Engine

NameDescriptionType
versionThe version of the Kyuubi server that creates this engine instanceString
userThe user created the engineString
engineTypeThe engine typeString
sharelevelThe engine share levelString
subdomainThe engine subdomainString
instancehost:port for the engine nodeString
namespaceThe namespace used to expose the engine to KyuubiServersString

评论

登录后参与评论

正在加载评论…