HTTP API Reference
A complete reference for Infinity's Python APIs.
SCHEMA MANAGEMENT
Create database
POST /databases/{database_name}
Creates a database by its name. If the database already exists, the action taken depends on the "create_option" parameter.
Request
- Method: POST
- URL:
/database/{database_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"create_option":enum<string>
Request example
curl --request POST \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"create_option": "ignore_if_exists"} '
Request parameters
database_name: (Path parameter)
The name of the database, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"create_option": (Body parameter),enum<string>, Optional"error": (Default) Raise an error if a database with the same name exists."ignore_if_exists": Ignore the database creation request and keep the existing database.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3016,
"error_msg": "Duplicate database: {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
Drop database
DELETE /databases/{database_name}
Deletes a database by its name. If the database does not exist, the action taken depends on the "drop_option" parameter.
Request
- Method: DELETE
- URL:
/database/{database_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"drop_option":enum<string>
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"drop_option": "error"} '
Request parameter
database_name: (Path parameter)
The name of the database to delete."drop_option": (Body parameter),enum<string>, Optional"error": (Default) Raise an error if the specified database does not exist."ignore_if_not_exists": Ignore the operation and proceed regardless, if the specified database does not exist.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3021,
"error_msg": "{database_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
List databases
GET /databases
Retrieves a list of all available databases within the Infinity system.
Request
- Method: GET
- URL:
/databases - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases \
--header 'accept: application/json'
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"databases": [
"default_db",
"my_db"
]
}
"error_code":integer
0: The operation succeeds.databases:string[]
An array of strings representing the names of the databases in the system.
Show database
GET /databases/{database_name}
Shows detailed information about a specified database.
Request
- Method: GET
- URL:
/database/{database_name} - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name} \
--header 'accept: application/json'
Request parameter
database_name: (Path parameter)
The name of the database to retrieve.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db"
"storage_directory": "/var/infinity/data/nIHniKeHIB_db_default"
"table_count": "4"
}
"error_code":integer
0: The operation succeeds.database_name:string
The name of the database.storage_directory:string
The directory path where the database is stored.table_count:integer
The number of tables present in the database.
The response includes a JSON object like the following:
{
"error_code": 3021,
"error_msg": "{database_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
Create table
POST /databases/{database_name}/tables/{table_name}
Creates a table with a specified name and defined fields (columns) within a given database. If the table already exists, the action taken depends on the "create_option" parameter.
Request
- Method: POST
- URL:
/databases/{database_name}/tables/{table_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"create_option":enum<string>"fields":object[]
Request example
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"create_option": "ignore_if_exists",
"fields": [
{
"name": "name",
"type": "varchar",
"comment": "name column"
},
{
"name": "score",
"type": "float",
"default": 3.0
},
{
"name": "dense_column",
"type": "vector,8,float",
"default": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
},
{
"name": "fulltext_column",
"type": "varchar",
"default": ""
},
{
"name": "sparse_column",
"type": "sparse,128,float,int",
"default": {"10":1.1, "20":2.2, "30": 3.3}
},
{
"name": "tensor_column",
"type": "tensor,4,float",
"default": [[1.0, 0.0, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]]
},
{
"name": "multivector_column",
"type": "multivector,4,float",
"default": [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
},
{
"name": "tensorarray_column",
"type": "tensorarray,2,float",
"default": [[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0]]]
}
]
} '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table to create, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"create_option": (Body parameter),enum<string>, Optional"error": (Default) Raise an error if a table with the same name exists."ignore_if_exists": Ignore the table creation request and keep the existing table.
field: (Body parameter),object[], Required"name":string, Required
A non-empty string indicating the name of the column to create, which must adhere to the following requirements:- Permitted characters include:
- English letters (a-z, A-Z)
- Digits (0-9)
- "_" (underscore)
- Must begin with an English letter or underscore.
- Maximum 65,535 characters.
- Case-insensitive.
- Permitted characters include:
"type":string, Required
The data type of the column.- Numeric:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- String:
"varchar" - Dense vector: e.g.,
"vector,128,float"vector: The column is a dense vector column.- The second item in the string: The dimension of dense vectors.
- The third item in the string: The element type of dense vectors. Can be:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- Sparse vector: e.g.,
"sparse,128,float,int"sparse: The column is a sparse vector column.- The second item in the string: The dimension of sparse vectors.
- The third item in the string: The element type of sparse vectors. Can be:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- The fourth item in the string: The data type of the sparse vector indices. Can be:
int8int16int/int32/integerint64
- Tensor vector: e.g.,
"tensor,4,float"tensor: The column is a tensor column.- The second item in the string: The dimension of each vector unit in a tensor.
- The third item in the string: The element type of the tensors. Can be:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- Tensor array: e.g.,
"tensorarray,6,float"tensorarray: The column is a tensor-array column.- The second item in the string: The dimension of each vector unit in a tensor array.
- The third item in the string: The element type of tensor arrays. Can be:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- Multivector: e.g.,
"multivector,128,float"multivector: The column is a multi-vector column.- The second item in the string: The dimension of each vector unit in a multi-vector.
- The third item in the string: The element type of multi-vectors. Can be:
"int8""int16""int"/"int32"/"integer""int64""float"/"float32""double"/"float64""float16""bfloat16"
- Array: e.g.,
"array,varchar","array,array,varchar"array: The column is an array column.- followed by the element type of the array. Can be recursive.
- for example,
"array,varchar"is a one-dimensional array of strings, and"array,array,varchar"is a two-dimensional array of strings.
- Numeric:
"default":Any, Optional
The default value for unspecified cells in that column."comment":string, Optional User provided text to describe the column.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3017,
"error_msg": "Duplicate table: {table_name} in {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
Drop table
DELETE /databases/{database_name}/tables/{table_name}
Deletes a table from a specified database. If the table does not exist, the action taken depends on the "drop_option" parameter.
Request
- Method: DELETE
- URL:
/databases/{database_name}/tables/{table_name} - Headers:
accept: application/jsoncontent-Type: application/json- Body:
"drop_option":enum<string>
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"drop_option": "ignore_if_not_exists"} '
Request parameters
database_name: (Path parameter) The name of the database.table_name: (Path parameter) The name of the table to delete."drop_option": (Body parameter),enum<string>, Optional"error": (Default) Raise an error if the specified table does not exist."ignore_if_not_exists": Ignore the operation and proceed regardless, if the specified database does not exist.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_msg": "Table {table_name} doesn't exist in {database_name}."
}
"error_code":integerA non-zero value indicates a specific error condition."error_msg":stringWhenerror_codeis non-zero,"error_msg"provides additional details about the error.
List tables
GET /databases/{database_name}/tables
Retrieves a list of all available tables in a specified database.
Request
- Method: GET
- URL:
/databases/{database_name}/tables - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables \
--header 'accept: application/json'
Request parameters
database_name: (Path parameter) The name of the database.
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"tables":
[
"table_1",
"table_2",
"table_n"
]
}
"error_code":integer0: The operation succeeds.
create table snapshot
POST /snapshots
Creates a snapshot of the specified table with the given snapshot name.
Request
- Method: POST
- URL:
/snapshots - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"db_name":string"table_name":string"snapshot_name":string
Request example
curl --request POST \
--url http://localhost:23820/snapshots \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"db_name" : "default_db",
"table_name" : "my_table",
"snapshot_name" : "my_snapshot"
} '
Request parameters
db_name: (Body parameter) The name of the database.table_name: (Body parameter) The name of the table.snapshot_name: (Body parameter) The name of the snapshot.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_msg": "{table_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
create database snapshot
POST /snapshots/database
Creates a snapshot of the specified database with the given snapshot name.
Request
- Method: POST
- URL:
/snapshots/database - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"db_name":string"snapshot_name":string
Request example
curl --request POST \
--url http://localhost:23820/snapshots/database \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"db_name" : "default_db",
"snapshot_name" : "my_snapshot"
} '
Request parameters
db_name: (Body parameter) The name of the database.snapshot_name: (Body parameter) The name of the snapshot.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3021,
"error_msg": "{db_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_msg":string
Whenerror_codeis non-zero,"error_msg"provides additional details about the error.
create system snapshot
POST /snapshots/system
Creates a snapshot of the system with the given snapshot name.