Update an existing custom metric
curl --request PUT \
--url https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric": {
"key": "<string>",
"description": "<string>",
"options": [
"<string>"
]
}
}
'import requests
url = "https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}"
payload = { "metric": {
"key": "<string>",
"description": "<string>",
"options": ["<string>"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({metric: {key: '<string>', description: '<string>', options: ['<string>']}})
};
fetch('https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}', 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://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metric' => [
'key' => '<string>',
'description' => '<string>',
'options' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}"
payload := strings.NewReader("{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"metric": {
"id": "<string>",
"key": "<string>",
"description": "<string>",
"isSystem": true,
"options": [
"<string>"
],
"createdAtUNIX": 123,
"updatedAtUNIX": 123
}
}{
"message": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>"
}
]
}Custom Metrics
Update Custom Metric
Update an existing custom metric configuration
PUT
/
agents
/
{agentId}
/
custom-metrics
/
{metricId}
Update an existing custom metric
curl --request PUT \
--url https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric": {
"key": "<string>",
"description": "<string>",
"options": [
"<string>"
]
}
}
'import requests
url = "https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}"
payload = { "metric": {
"key": "<string>",
"description": "<string>",
"options": ["<string>"]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({metric: {key: '<string>', description: '<string>', options: ['<string>']}})
};
fetch('https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}', 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://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metric' => [
'key' => '<string>',
'description' => '<string>',
'options' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}"
payload := strings.NewReader("{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.put("https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://eu-gcp-api.vg-stuff.com/v3/agents/{agentId}/custom-metrics/{metricId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric\": {\n \"key\": \"<string>\",\n \"description\": \"<string>\",\n \"options\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "<string>",
"metric": {
"id": "<string>",
"key": "<string>",
"description": "<string>",
"isSystem": true,
"options": [
"<string>"
],
"createdAtUNIX": 123,
"updatedAtUNIX": 123
}
}{
"message": "<string>",
"code": "<string>",
"issues": [
{
"message": "<string>"
}
]
}Overview
Updates the configuration of an existing custom metric. You can modify the description, type, and options (for enum types).Partial Updates
You only need to include the fields you want to update:{
"metric": {
"description": "Updated description for the metric"
}
}
Updating Enum Options
For enum type metrics, you can add or modify options:{
"metric": {
"options": ["positive", "negative", "neutral", "mixed"]
}
}
Important Considerations:
- Changing the metric type may affect existing data interpretation
- Historical data is not automatically converted when you change types
- Duplicate keys are not allowed - the update will fail if the new key already exists
Use Cases
- Refine Descriptions: Make metric descriptions clearer
- Add Enum Options: Expand categorical options as needs evolve
- Correct Typos: Fix mistakes in metric configuration
- Update Metadata: Keep metric information current
System metrics (where
isSystem: true) cannot be updated via the API.Example: Expanding Options
{
"metric": {
"description": "Customer sentiment with granular options",
"options": [
"very_positive",
"positive",
"neutral",
"negative",
"very_negative"
]
}
}
Common Update Scenarios
Update Description Only
{
"metric": {
"description": "Updated: Customer satisfaction rating on a scale of 1-10"
}
}
Update Key
{
"metric": {
"key": "customer_satisfaction_v2"
}
}
Update Type
{
"metric": {
"type": "enum",
"options": ["low", "medium", "high"]
}
}
Before changing a metric’s type, consider creating a new metric instead to preserve historical data integrity.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the agent
The unique identifier of the metric to update
Body
application/json
Show child attributes
Show child attributes
⌘I
