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_message": "Duplicate database: {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"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_message": "{database_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"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_message": "{database_name} doesn't exist."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"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"
- 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_message": "Duplicate table: {table_name} in {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"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":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"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":integer
0: The operation succeeds.
Show table
GET /databases/{database_name}/tables/{table_name}
Shows detailed information about a specified table within a given database.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name} - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json'
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db",
"table_name": "my_table",
"storage_directory": "/var/infinity/data/nIHniKeHIB_db_default/h1abZcWuBs_table_my_table",
"column_count" : 3,
"segment_count" : 1,
"row_count" : 5
}
"error_code":integer
0: The operation succeeds.
A 500 HTTP status code indicates an error condition. The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Show table columns
GET /databases/{database_name}/tables/{table_name}/columns
Shows the column information about a specified table.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/columns - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/columns \
--header 'accept: application/json'
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"columns":
[
{
"column_name": "name",
"column_type": "Varchar",
"constraints": "",
"default": "Null"
},
{
"column_name": "score",
"column_type": "Float",
"constraints": "",
"default": "Null",
}
{
"column_name": "vector_column",
"column_type": "Embedding(float,8)",
"constraints": "",
"default": "Null"
},
]
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3022,
"error_message": "Table {table_name} doesn't exist in {database_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Create index
POST /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Creates an index on a specified table. If an index with the same name exists, the action taken depends on the "create_option" parameter.
Request
- Method: POST
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"fields":string[]"index":object"create_option":enum<string>
Request example
- Creates an HNSW index on a dense vector or a multivector column:
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"dense_column"
],
"index":
{
"type": "Hnsw",
"M": "16",
"ef_construction": "50",
"metric": "l2"
},
"create_option": "ignore_if_exists"
} '
- Creates a full-text index on a full-text column:
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"fulltext_column"
],
"index":
{
"type": "fulltext",
"analyzer": "chinese"
},
"create_option": "ignore_if_exists"
} '
- Creates a BMP index on a sparse column
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"sparse_column"
],
"index":
{
"type": "BMP",
"block_size": "16",
"compress_type": "raw"
},
"create_option": "ignore_if_exists"
} '
- Creates a secondary index on a varchar column
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"fields":
[
"varchar_column"
],
"index":
{
"type": "Secondary"
},
"create_option": "ignore_if_exists"
} '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table.index_name: (Path parameter)
The name of the index 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:
"fields": (Body parameter),string[], Required
A non-empty list of strings indicating the names of the columns to build index on. For now, you are only allowed to create an index on one column."index": (Body parameter),dict[string, string]- Parameter settings for an HNSW index:
"type":"hnsw""M": Optional - Defaults to"16"."ef_construction": Optional - Defaults to"50"."metric"Required - The distance metric to use in similarity search."ip": Inner product."l2": Euclidean distance."cosine": Cosine similarity.
"encode": Optional"plain": (Default) Plain encoding."lvq": Locally-adaptive vector quantization. Works with float vector element only.
- Parameter settings for an IVF index:
"metric"Required - The distance metric to use in similarity search."ip": Inner product."l2": Euclidean distance."cosine": Cosine similarity.
"storage_type": Optional"plain": (Default) Plain storage."scalar_quantization": Scalar quantization."product_quantization": Product quantization.
"plain_storage_data_type": Optional for plain storage."int8": default value forint8embeddings."uint8": default value foruint8embeddings."float32": default value for floating-point embeddings."float16": for floating-point embeddings."bfloat16": for floating-point embeddings.
"scalar_quantization_bits": Required for scalar quantization. Must be either4or8."product_quantization_subspace_num": Required for product quantization. Must be divisor of the embedding dimension."product_quantization_subspace_bits": Required for product quantization. Must be in the range[4, 16].
- Parameter settings for a full-text index:
"type":"fulltext""ANALYZER": Optional"standard": (Default) Standard analyzer, segmented by tokens, lowercase processing, provides stemming outputs. Use-to specify stemmer for languages,Englishis the default stemmer:"standard-english"and"standard"have the same stemmer setting. Supported language stemmer includes:Danish,Dutch,English,Finnish,French,German,Hungarian,Italian,Norwegian,Porter,Portuguese,Romanian,Russian,Spanish,Swedish,Turkish."rag": Multilingual RAG analyzer imported from RAGFlow, supportingChineseandEnglish. Use-fineto output the fine-grained analyzer results."chinese": Simplified Chinese. Use-fineto output the fine-grained analyzer results."ik": Bilingual analyzer imported from ik-analyzer, supportingChineseandEnglish. Use-fineto output the fine-grained analyzer results."traditional": Traditional Chinese."japanese": Japanese."korean": Korean."ngram": N-gram."keyword": "noop" analyzer used for columns containing keywords only.
- Parameter settings for a secondary index:
"type":"secondary"
- Parameter settings for a BMP index:
"type":"bmp"block_size: Optional - The size of the block in a BMP index. Range:"1"~"256". Defaults to"16"."compress_type": Optional"compress": (Default) Store the block-max index in sparse format. Works best with small block size situations."raw": Store the block-max index without compression.
- Parameter settings for an HNSW index:
"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.
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": 3018,
"error_message": "Duplicate index: {index} in {table_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Drop index
DELETE /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Deletes an index by its name.
Request
- Method: DELETE
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_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}/indexes/{index_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.index_name: (Path parameter)
The name of the index to delete."drop_option": (Body parameter),enum<string>, Optional"error": (Default) Raise an error if the specified index does not exist."ignore_if_not_exists": Ignore the operation and proceed regardless, if the specified index 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": 3018,
"error_message": "Index {index_name} doesn't exist in {table_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
List indexes
GET /databases/{database_name}/tables/{table_name}/indexes
Retrieves a list of all indexes created on a given table.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/indexes - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes \
--header 'accept: application/json'
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table.
Response
Status code 200
The response includes a JSON object like the following:
{
"error_code": 0,
"indexes":
[
{
"columns": "vector_column_1",
"index_name": "idx1",
"index_type": "HNSW"
},
{
"columns": "vector_column_2",
"index_name": "idx2",
"index_type": "HNSW"
}
]
}
"error_code":integer
0: The operation succeeds.
Show index
GET /databases/{database_name}/tables/{table_name}/indexes/{index_name}
Shows detailed information about a specified index.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name}/indexes/{index_name} - Headers:
accept: application/json
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/indexes/{index_name} \
--header 'accept: application/json'
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table.index_name: (Path parameter)
The name of the index.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"database_name": "default_db",
"table_name": "test_vector_table",
"index_name": "idx1",
"index_column_ids": "2",
"index_column_names": "vector_column",
"index_type": "HNSW",
"other_parameters": "metric = l2, encode_type = plain, M = 16, ef_construction = 50",
"segment_index_count": "0",
"storage_directory": "/var/infinity/data/3C1tizeluV_db_default_db/O0wSJ88IrJ_table_test_vector_table/RYurmCbD5h_index_idx1"
"storage_size": "0B"
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3018,
"error_message": "Index {index_name} doesn't exist in {table_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
DATA MANAGEMENT
Import data
PUT /databases/{database_name}/tables/{table_name}
Imports data from a selected file into a specified table.
Request
- Method: PUT
- URL:
/databases/{database_name}/tables/{table_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"file_path":string"file_type":string"header":boolean"delimiter":string
Request example
curl --request PUT \
--url http://localhost:23820/databases/{database_name}/tables/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"file_path":"./filename.csv",
"file_type":"csv",
"header": true,
"delimiter": `\t"
} '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table."file_path": (Body parameter)
Absolute path to the file to import"file_type": (Body parameter)
The type of the file to import. Supported file types include:csvjsonjsonlparquet
"header": (Body parameter),boolean, Optional
Whether to display table header or not. Works with .csv files only:True: Display table header.False: (Default) Do not display table header.
"delimiter": (Body parameter),string, Optional, Defaults to ","
Delimiter to separate columns. Works with .csv files only.
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": 3032,
"error_message": "Not supported file type: docx"
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Export data
GET /databases/{database_name}/tables/{table_name}
Exports data from a specified table to a specified file.
Request
- Method: GET
- URL:
/databases/{database_name}/tables/{table_name} - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"file_path":string"file_type":string"header":boolean"delimiter":string"offset":int"limit":int"row_limit":int
Request example
curl --request GET \
--url http://localhost:23820/databases/{database_name}/table/{table_name} \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {
"file_path": "/var/infinity/filename.csv",
"file_type": "csv",
"header": false,
"delimiter": "\t",
"offset": 2,
"limit": 6,
"row_limit": 2
} '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table."file_path": (Body parameter)
Absolute path to the file for export."file_type": (Body parameter)
The type of the file for export. Supported file types include:csvjsonlparquet
"header": (Body parameter),boolean, Optional Whether to display table header or not. Works with .csv files only:True: Display table header.False: (Default) Do not display table header.
"delimiter": (Body parameter),string, Optional, Defaults to ","
Delimiter to separate columns. Works with .csv files only."offset": (Body parameter),int, Optional
Index specifying the starting row for export. Usually used in conjunction withlimit. If not specified, the file export starts from the first row."limit":int, Optional
The maximum number of rows to export. Usually used in conjunction withoffset. If the table's row count exceedsoffset+limit, the excess rows are excluded from the export."row_limit": (Body parameter),int, Optional
Used when you have a large table and need to break the output file into multiple parts. This argument sets the row limit for each part. If you specify test_export_file.csv as the file name, the exported files will be named test_export_file.csv, test_export_file.csv.part1, test_export_file.csv.part2, and so on.
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": 7002,
"error_message": "File already existed: /var/infinity/filename.csv"
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Insert data
POST /databases/{database_name}/tables/{table_name}/docs
Inserts rows of data into a specified table.
Request
- Method: POST
- URL:
/databases/{database_name}/tables/{table_name}/docs - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
object[]
Request example
curl --request POST \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/docs \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
[
{
"name": "Jennifer",
"score": 5.0,
"fulltext_column": "You have a heart like gold.",
"dense_column": [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"sparse_column": {"10":1.1, "20":2.2, "30": 3.3},
"tensor_column": [[1.0, 0.0, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]],
"tensorarray_column": [[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0]]],
"multivector_column": [[1.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
},
{
"name": "Neil",
"score": 2.0,
"fulltext_column": "You're absolutely lucky.",
"dense_column": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
"sparse_column": {"10":1.1, "20":2.2, "30": 3.3},
"tensor_column": [[1.0, 0.0, 0.0, 0.0], [1.1, 0.0, 0.0, 0.0]],
"tensorarray_column": [[[1.0, 1.0], [1.0, 1.0]], [[1.0, 1.0]]],
"multivector_column": [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
}
] '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table."file_path": (Body parameter),string, RequiredBody: (Body parameter),object[], Required
Data to insert. Infinity supports inserting multiple rows to a table at one time in the form ofobject[]. Each JSON object corresponds to a row to insert, and each key-value pair it corresponds to a column name and the table cell value.
- When inserting incomplete rows of data, ensure that all uninserted columns have default values when creating the table. Otherwise, an error will occur.
- You are not allowed to insert both complete and incomplete rows of data in one request.
Batch row limit: 8,192. You are allowed to insert a maximum of 8,192 rows at once.
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": 3005,
"error_message": "Column {column_name} doesn't exist in {table_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Delete data
DELETE /databases/{database_name}/tables/{table_name}/docs
Deletes rows from a table based on the specified condition.
Request
- Method: DELETE
- URL:
/databases/{database_name}/tables/{table_name}/docs - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"filter":string
Request example
curl --request DELETE \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/docs \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"filter": "score >= 4.0 and score <= 5.0"} '
curl --request DELETE \
--url http://localhost:23820/databases/{database_name}/tables/{table_name}/docs \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data ' {"filter": "name = '"'Toby'"'"} '
Request parameters
database_name: (Path parameter)
The name of the database.table_name: (Path parameter)
The name of the table."filter": (Body parameter),string, Optional
A string that defines the condition for selecting rows to delete. The parameter can be an expression, a function, or any other form of conditional logic that evaluates toTruefor the rows that should be deleted. If"filter"is not specified or set toNull, the method will delete all rows in the table.
Response
- Status code 200
- Status code 500
The response includes a JSON object like the following:
{
"error_code": 0,
"deleted_rows": 10
}
"error_code":integer
0: The operation succeeds.
The response includes a JSON object like the following:
{
"error_code": 3005,
"error_message": "Column {column_name} doesn't exist in {table_name}."
}
"error_code":integer
A non-zero value indicates a specific error condition."error_message":string
Whenerror_codeis non-zero,"error_message"provides additional details about the error.
Update data
PUT /databases/{database_name}/tables/{table_name}/docs
Searches for rows that match the specified condition and updates them accordingly.
Request
- Method: PUT
- URL:
/databases/{database_name}/tables/{table_name}/docs - Headers:
accept: application/jsoncontent-Type: application/json
- Body:
"update":object"filter":string