Update Collection.
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/collections/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Collection Name",
"description": "Updated description"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/collections/{id}"
payload = {
"name": "Updated Collection Name",
"description": "Updated description"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Updated Collection Name', description: 'Updated description'})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/collections/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents/collections/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Collection Name',
'description' => 'Updated description'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/collections/{id}"
payload := strings.NewReader("{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tryhamsa.com/v1/voice-agents/collections/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/collections/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Collection updated successfully",
"data": {
"id": "d949f13f-40d2-4e48-ac86-b66633070603",
"name": "Customer Support Tools",
"description": "Tools used for customer support operations",
"userId": "d949f13f-40d2-4e48-ac86-b66633070603",
"projectId": "d949f13f-40d2-4e48-ac86-b66633070603",
"webToolsCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Collections
Update Collection
Updates an existing collection’s name or description.
PATCH
/
v1
/
voice-agents
/
collections
/
{id}
Update Collection.
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/collections/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Collection Name",
"description": "Updated description"
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/collections/{id}"
payload = {
"name": "Updated Collection Name",
"description": "Updated description"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: 'Updated Collection Name', description: 'Updated description'})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/collections/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryhamsa.com/v1/voice-agents/collections/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Collection Name',
'description' => 'Updated description'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.tryhamsa.com/v1/voice-agents/collections/{id}"
payload := strings.NewReader("{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.tryhamsa.com/v1/voice-agents/collections/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/collections/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Collection Name\",\n \"description\": \"Updated description\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Collection updated successfully",
"data": {
"id": "d949f13f-40d2-4e48-ac86-b66633070603",
"name": "Customer Support Tools",
"description": "Tools used for customer support operations",
"userId": "d949f13f-40d2-4e48-ac86-b66633070603",
"projectId": "d949f13f-40d2-4e48-ac86-b66633070603",
"webToolsCount": 5,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}Authorizations
Pass the API key in the Authorization header, You need to put Token keyword before the API key. e.g. 'Authorization: Token '
Path Parameters
UUID of the collection to update.
Example:
"d949f13f-40d2-4e48-ac86-b66633070603"
Body
application/json
Was this page helpful?
⌘I