This topic describes how to create a partition in a collection by using the HTTP API.
Prerequisites
A cluster is created. For more information, see Create a cluster.
An API key is obtained. For more information, see Manage API keys.
The SDK of the latest version is installed. For more information, see Install DashVector SDK.
Method and URL
POST https://{Endpoint}/v1/collections/{CollectionName}/partitions
Example
You need to replace YOUR_API_KEY with your API key and YOUR_CLUSTER_ENDPOINT with the endpoint of your cluster in the sample code for the code to run properly.
You need to create a collection named
quickstart
in advance. For more information, see the "Example" section of the Create a collection topic.
curl -XPOST \
-H 'dashvector-auth-token: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"name": "shoes"
}' https://YOUR_CLUSTER_ENDPOINT/v1/collections/quickstart/partitions
# example output:
# {"request_id":"19215409-ea66-4db9-8764-26ce2eb5bb99","code":0,"message":""}
Request parameters
Parameter | Location | Type | Required | Description |
{Endpoint} | path | str | Yes | The endpoint of the cluster. You can view the endpoint on the cluster details page in the console. |
{CollectionName} | path | str | Yes | The name of the collection in which the partition is to be created. |
dashvector-auth-token | header | str | Yes | The API key. |
name | body | str | Yes | The name of the partition to be created. |
Response parameters
Parameter | Type | Description | Example |
code | int | The returned status code. For more information, see Status codes. | 0 |
message | str | The returned message. | success |
request_id | str | The unique ID of the request. | 19215409-ea66-4db9-8764-26ce2eb5bb99 |