# REST API v1 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 | Name | Description | Type | |:-----------|:---------------------------------------------------------|:-------| | identifier | The session identifier | String | | user | The user name that created the session | String | | ipAddr | The client IP address that created the session | String | | conf | The configuration of the session | Map | | createTime | The session that created at this timestamp | Long | | duration | The interval that last access time subtract created time | Long | | idleTime | The interval of no operation | Long | ### GET /sessions/${sessionHandle} Get a session event #### Response Body The [KyuubiSessionEvent](#kyuubisessionevent). ### GET /sessions/${sessionHandle}/info/${infoType} Get an information detail of a session #### Request Parameters | Name | Description | Type | |:---------|:------------------------------|:-----| | infoType | The id of Hive Thrift GetInfo | Int | #### Response Body | Name | Description | Type | |:----------|:---------------------------------|:-------| | infoType | The type of session information | String | | infoValue | The value of session information | String | ### GET /sessions/count Get the current open session count #### Response Body | Name | Description | Type | |:-----------------|:-----------------------------|:-----| | openSessionCount | The count of opening session | Int | ### GET /sessions/execPool/statistic Get statistic info of background executors #### Response Body | Name | Description | Type | |:--------------------|:--------------------------------------------------------------------|:-----| | execPoolSize | The current number of threads in the pool | Int | | execPoolActiveCount | The approximate number of threads that are actively executing tasks | Int | ### POST /sessions Create a session #### Request Parameters | Name | Description | Type | |:----------------|:-----------------------------------------|:-------| | protocolVersion | The protocol version of Hive CLI service | Int | | user | The user name | String | | password | The user password | String | | ipAddr | The user client IP address | String | | configs | The configuration of the session | Map | #### Response Body | Name | Description | Type | |:-----------|:------------------------------|:-------| | identifier | The session handle identifier | String | ### DELETE /sessions/${sessionHandle} Close a session. ### POST /sessions/${sessionHandle}/operations/statement Create an operation with EXECUTE_STATEMENT type #### Request Body | Name | Description | Type | |:-------------|:---------------------------------------------------------------|:--------| | statement | The SQL statement that you execute | String | | runAsync | The flag indicates whether the query runs synchronously or not | Boolean | | queryTimeout | The interval of query time out | Long | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/typeInfo Create an operation with GET_TYPE_INFO type #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/catalogs Create an operation with GET_CATALOGS type #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/schemas Create an operation with GET_SCHEMAS type #### Request Body | Name | Description | Type | |:------------|:-----------------|:-------| | catalogName | The catalog name | String | | schemaName | The schema name | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/tables #### Request Body | Name | Description | Type | |:------------|:----------------------------------------------|:-------| | catalogName | The catalog name | String | | schemaName | The schema name | String | | tableName | The table name | String | | tableTypes | The type of table, for example: TABLE or VIEW | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/tableTypes #### Request Parameters #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/columns #### Request Body | Name | Description | Type | |:------------|:-----------------|:-------| | catalogName | The catalog name | String | | schemaName | The schema name | String | | tableName | The table name | String | | columnName | The column name | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/functions #### Request Body | Name | Description | Type | |:-------------|:------------------|:-------| | catalogName | The catalog name | String | | schemaName | The schema name | String | | functionName | The function name | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/primaryKeys #### Request Parameters | Name | Description | Type | |:------------|:-----------------|:-------| | catalogName | The catalog name | String | | schemaName | The schema name | String | | tableName | The table name | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ### POST /sessions/${sessionHandle}/operations/crossReference | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | #### Request Body | Name | Description | Type | |:---------------|:-------------------------|:-------| | primaryCatalog | The primary catalog name | String | | primarySchema | The primary schema name | String | | primaryTable | The primary table name | String | | foreignCatalog | The foreign catalog name | String | | foreignSchema | The foreign schema name | String | | foreignTable | The foreign table name | String | #### Response Body | Name | Description | Type | |:-----------|:----------------------------|:-------| | identifier | The identifier of operation | String | ## Operation Resource ### GET /operations/${operationHandle}/event Get the current event of the operation by the specified operation handle. #### Response Body The [KyuubiOperationEvent](#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'.