Python
from actian_vectorai_client import VectorAIClient
with VectorAIClient("localhost:6574") as client:
# Check if collection exists
exists = client.collections.exists("my_collection")
print(f"Collection exists: {exists}")import { VectorAIClient } from '@actian/vectorai-client';
const client = new VectorAIClient('localhost:6574');
const exists = await client.collections.exists('my_collection');
console.log(`Collection exists: ${exists}`);
client.close();curl -X GET "http://localhost:6575/collections/my_collection/exists" \
-H "Accept: application/json" \
-H 'Authorization: Bearer <admin-jwt-or-access-token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "6575",
CURLOPT_URL => "http://localhost:6575/collections/{collection_name}/exists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:6575/collections/{collection_name}/exists"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:6575/collections/{collection_name}/exists")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:6575/collections/{collection_name}/exists")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"usage": {
"hardware": null
},
"time": 0.000002404,
"status": "ok",
"result": {
"exists": true
}
}Collections
Check if collection exists
Check whether a collection with the given name exists in the database.
GET
/
collections
/
{collection_name}
/
exists
Python
from actian_vectorai_client import VectorAIClient
with VectorAIClient("localhost:6574") as client:
# Check if collection exists
exists = client.collections.exists("my_collection")
print(f"Collection exists: {exists}")import { VectorAIClient } from '@actian/vectorai-client';
const client = new VectorAIClient('localhost:6574');
const exists = await client.collections.exists('my_collection');
console.log(`Collection exists: ${exists}`);
client.close();curl -X GET "http://localhost:6575/collections/my_collection/exists" \
-H "Accept: application/json" \
-H 'Authorization: Bearer <admin-jwt-or-access-token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "6575",
CURLOPT_URL => "http://localhost:6575/collections/{collection_name}/exists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:6575/collections/{collection_name}/exists"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:6575/collections/{collection_name}/exists")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:6575/collections/{collection_name}/exists")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"usage": {
"hardware": null
},
"time": 0.000002404,
"status": "ok",
"result": {
"exists": true
}
}Authorizations
Admin JWT or access token for authenticating requests to VectorAI DB.
Path Parameters
The name of the collection to check.
Example:
"my_collection"
⌘I