Apply indexes and unique constraints
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"applied": true,
"collection_id": "<string>",
"indexes": [
{
"properties": [
"sku"
]
}
],
"uniques": [
{
"properties": [
"sku"
]
}
]
}{
"error": "InvalidArguments",
"message": "<string>"
}{
"error": "InvalidArguments",
"message": "<string>"
}Schema
Apply indexes and unique constraints
Applies indexes and unique constraints to an existing collection. Provide the full desired set; the constraints are persisted so a later schema change re-applies them. A unique constraint is required to use a column as an upsert key in bulk import.
POST
/
v1
/
collections
/
{collection_id}
/
indexes
Apply indexes and unique constraints
curl --request POST \
--url https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{host}/v2/workspaces/slug:ai-collection-v3/webhooks/v1/collections/{collection_id}/indexes"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"applied": true,
"collection_id": "<string>",
"indexes": [
{
"properties": [
"sku"
]
}
],
"uniques": [
{
"properties": [
"sku"
]
}
]
}{
"error": "InvalidArguments",
"message": "<string>"
}{
"error": "InvalidArguments",
"message": "<string>"
}Authorizations
BearerAuthOrgApiKeyAuth
User session JWT. Send as Authorization: Bearer <token>.
Path Parameters
Collection identifier returned at creation.
Body
application/json
Was this page helpful?