Update segment
curl --request PUT \
--url https://api.vantage.sh/v2/segments/{segment_token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"priority": 123,
"track_unallocated": false,
"report_settings": {
"include_credits": true,
"include_refunds": true,
"include_discounts": true,
"include_tax": true,
"amortize": true
},
"filter": "<string>",
"parent_segment_token": "<string>"
}
'import requests
url = "https://api.vantage.sh/v2/segments/{segment_token}"
payload = {
"title": "<string>",
"description": "<string>",
"priority": 123,
"track_unallocated": False,
"report_settings": {
"include_credits": True,
"include_refunds": True,
"include_discounts": True,
"include_tax": True,
"amortize": True
},
"filter": "<string>",
"parent_segment_token": "<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({
title: '<string>',
description: '<string>',
priority: 123,
track_unallocated: false,
report_settings: {
include_credits: true,
include_refunds: true,
include_discounts: true,
include_tax: true,
amortize: true
},
filter: '<string>',
parent_segment_token: '<string>'
})
};
fetch('https://api.vantage.sh/v2/segments/{segment_token}', 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.vantage.sh/v2/segments/{segment_token}",
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([
'title' => '<string>',
'description' => '<string>',
'priority' => 123,
'track_unallocated' => false,
'report_settings' => [
'include_credits' => true,
'include_refunds' => true,
'include_discounts' => true,
'include_tax' => true,
'amortize' => true
],
'filter' => '<string>',
'parent_segment_token' => '<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://api.vantage.sh/v2/segments/{segment_token}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\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://api.vantage.sh/v2/segments/{segment_token}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/segments/{segment_token}")
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 \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "fltr_sgmt_1550eb291314035c",
"title": "Updated Segment",
"parent_segment_token": "fltr_sgmt_a39cf865967ed4d8",
"description": "This segment is updated.",
"track_unallocated": false,
"priority": 42,
"filter": "costs.provider = 'azure'",
"created_at": "2024-05-14T14:34:23Z",
"workspace_token": "wrkspc_1be9d0445f94db0b",
"report_token": "rprt_3e460438ae115013"
}{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}Segments
Update segment
Update a Segment.
PUT
/
segments
/
{segment_token}
Update segment
curl --request PUT \
--url https://api.vantage.sh/v2/segments/{segment_token} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"description": "<string>",
"priority": 123,
"track_unallocated": false,
"report_settings": {
"include_credits": true,
"include_refunds": true,
"include_discounts": true,
"include_tax": true,
"amortize": true
},
"filter": "<string>",
"parent_segment_token": "<string>"
}
'import requests
url = "https://api.vantage.sh/v2/segments/{segment_token}"
payload = {
"title": "<string>",
"description": "<string>",
"priority": 123,
"track_unallocated": False,
"report_settings": {
"include_credits": True,
"include_refunds": True,
"include_discounts": True,
"include_tax": True,
"amortize": True
},
"filter": "<string>",
"parent_segment_token": "<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({
title: '<string>',
description: '<string>',
priority: 123,
track_unallocated: false,
report_settings: {
include_credits: true,
include_refunds: true,
include_discounts: true,
include_tax: true,
amortize: true
},
filter: '<string>',
parent_segment_token: '<string>'
})
};
fetch('https://api.vantage.sh/v2/segments/{segment_token}', 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.vantage.sh/v2/segments/{segment_token}",
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([
'title' => '<string>',
'description' => '<string>',
'priority' => 123,
'track_unallocated' => false,
'report_settings' => [
'include_credits' => true,
'include_refunds' => true,
'include_discounts' => true,
'include_tax' => true,
'amortize' => true
],
'filter' => '<string>',
'parent_segment_token' => '<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://api.vantage.sh/v2/segments/{segment_token}"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\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://api.vantage.sh/v2/segments/{segment_token}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vantage.sh/v2/segments/{segment_token}")
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 \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"priority\": 123,\n \"track_unallocated\": false,\n \"report_settings\": {\n \"include_credits\": true,\n \"include_refunds\": true,\n \"include_discounts\": true,\n \"include_tax\": true,\n \"amortize\": true\n },\n \"filter\": \"<string>\",\n \"parent_segment_token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"token": "fltr_sgmt_1550eb291314035c",
"title": "Updated Segment",
"parent_segment_token": "fltr_sgmt_a39cf865967ed4d8",
"description": "This segment is updated.",
"track_unallocated": false,
"priority": 42,
"filter": "costs.provider = 'azure'",
"created_at": "2024-05-14T14:34:23Z",
"workspace_token": "wrkspc_1be9d0445f94db0b",
"report_token": "rprt_3e460438ae115013"
}{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}{
"errors": [
"<string>"
],
"links": {
"self": "<string>",
"first": "<string>",
"next": "<string>",
"last": "<string>",
"prev": "<string>"
}
}Authorizations
Body
application/json
Update a Segment.
The filter query language to apply to the Segment. Additional documentation available at https://docs.vantage.sh/vql.
Response
Segment model
The filter applied to the Segment. Additional documentation available at https://docs.vantage.sh/vql.