Update a web tool by Id.
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/web-tool/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 20
}
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/web-tool/{id}"
payload = { "toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 20
} }
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({
toolSettings: {
serverUrl: 'https://api.example.com/orders/status',
methodType: 'POST',
timeOut: 20
}
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/web-tool/{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/web-tool/{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([
'toolSettings' => [
'serverUrl' => 'https://api.example.com/orders/status',
'methodType' => 'POST',
'timeOut' => 20
]
]),
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/web-tool/{id}"
payload := strings.NewReader("{\n \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\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/web-tool/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/web-tool/{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 \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "009a3a7c-beb4-4471-9175-b49144daf4ad",
"type": "FUNCTION",
"userId": "095e678e-2b18-4138-aae9-f4d92b557104",
"projectId": "ec4215b3-c65d-494d-b268-5618647207d8",
"async": true,
"strict": true,
"description": "dasdsad",
"toolSettings": {
"httpHeaders": {
"key": "222",
"one": "two"
},
"pathParameters": {
"orderId": "48213"
},
"serverUrl": "http://google.com",
"timeout": 100000,
"authToken": "dasdsad",
"methodType": "POST",
"onHoldMusic": false,
"hasAuthToken": true,
"httpHeaderNames": [
"X-Account-Id"
]
},
"params": {
"location": {
"type": "string",
"description": "The location to get weather for"
}
},
"messages": [
{
"type": "system",
"content": "You are a helpful weather assistant."
}
],
"persistentId": "cmjx8qzw0000004kz3jek1ktu",
"version": 1,
"name": "Weather API Tool",
"isActive": true,
"collectionId": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Web Tools Routes
Update a web tool by Id.
deprecated
PATCH
/
v1
/
voice-agents
/
web-tool
/
{id}
Update a web tool by Id.
curl --request PATCH \
--url https://api.tryhamsa.com/v1/voice-agents/web-tool/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 20
}
}
'import requests
url = "https://api.tryhamsa.com/v1/voice-agents/web-tool/{id}"
payload = { "toolSettings": {
"serverUrl": "https://api.example.com/orders/status",
"methodType": "POST",
"timeOut": 20
} }
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({
toolSettings: {
serverUrl: 'https://api.example.com/orders/status',
methodType: 'POST',
timeOut: 20
}
})
};
fetch('https://api.tryhamsa.com/v1/voice-agents/web-tool/{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/web-tool/{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([
'toolSettings' => [
'serverUrl' => 'https://api.example.com/orders/status',
'methodType' => 'POST',
'timeOut' => 20
]
]),
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/web-tool/{id}"
payload := strings.NewReader("{\n \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\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/web-tool/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tryhamsa.com/v1/voice-agents/web-tool/{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 \"toolSettings\": {\n \"serverUrl\": \"https://api.example.com/orders/status\",\n \"methodType\": \"POST\",\n \"timeOut\": 20\n }\n}"
response = http.request(request)
puts response.read_body{
"success": false,
"message": "success",
"data": {
"id": "009a3a7c-beb4-4471-9175-b49144daf4ad",
"type": "FUNCTION",
"userId": "095e678e-2b18-4138-aae9-f4d92b557104",
"projectId": "ec4215b3-c65d-494d-b268-5618647207d8",
"async": true,
"strict": true,
"description": "dasdsad",
"toolSettings": {
"httpHeaders": {
"key": "222",
"one": "two"
},
"pathParameters": {
"orderId": "48213"
},
"serverUrl": "http://google.com",
"timeout": 100000,
"authToken": "dasdsad",
"methodType": "POST",
"onHoldMusic": false,
"hasAuthToken": true,
"httpHeaderNames": [
"X-Account-Id"
]
},
"params": {
"location": {
"type": "string",
"description": "The location to get weather for"
}
},
"messages": [
{
"type": "system",
"content": "You are a helpful weather assistant."
}
],
"persistentId": "cmjx8qzw0000004kz3jek1ktu",
"version": 1,
"name": "Weather API Tool",
"isActive": true,
"collectionId": "550e8400-e29b-41d4-a716-446655440000"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}{
"code": 8404,
"message": "Policy not found!",
"messageKey": "PolicyNotFound",
"params": {
"reason": "NO_DRAFT"
}
}Authorizations
Path Parameters
Body
application/json
Was this page helpful?