curl --request PUT \
--url https://v1.api.altostrat.io/content/bgp/policy/{policyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "High-Risk Geo-IP Block",
"enabled": true,
"lists": [
"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"
],
"sites": [
"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"
]
}
'import requests
url = "https://v1.api.altostrat.io/content/bgp/policy/{policyId}"
payload = {
"name": "High-Risk Geo-IP Block",
"enabled": True,
"lists": ["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"],
"sites": ["9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"]
}
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({
name: 'High-Risk Geo-IP Block',
enabled: true,
lists: ['9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c'],
sites: ['9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d']
})
};
fetch('https://v1.api.altostrat.io/content/bgp/policy/{policyId}', 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://v1.api.altostrat.io/content/bgp/policy/{policyId}",
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([
'name' => 'High-Risk Geo-IP Block',
'enabled' => true,
'lists' => [
'9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c'
],
'sites' => [
'9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d'
]
]),
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://v1.api.altostrat.io/content/bgp/policy/{policyId}"
payload := strings.NewReader("{\n \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\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://v1.api.altostrat.io/content/bgp/policy/{policyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v1.api.altostrat.io/content/bgp/policy/{policyId}")
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 \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "9b1d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8b",
"name": "Block Known Threats",
"enabled": true,
"default": false,
"lists": [
"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"
],
"site_count": 3,
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}Update a BGP Policy
Updates the properties of an existing BGP policy, including its name, status, selected IP lists, and site attachments.
curl --request PUT \
--url https://v1.api.altostrat.io/content/bgp/policy/{policyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "High-Risk Geo-IP Block",
"enabled": true,
"lists": [
"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"
],
"sites": [
"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"
]
}
'import requests
url = "https://v1.api.altostrat.io/content/bgp/policy/{policyId}"
payload = {
"name": "High-Risk Geo-IP Block",
"enabled": True,
"lists": ["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"],
"sites": ["9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"]
}
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({
name: 'High-Risk Geo-IP Block',
enabled: true,
lists: ['9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c'],
sites: ['9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d']
})
};
fetch('https://v1.api.altostrat.io/content/bgp/policy/{policyId}', 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://v1.api.altostrat.io/content/bgp/policy/{policyId}",
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([
'name' => 'High-Risk Geo-IP Block',
'enabled' => true,
'lists' => [
'9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c'
],
'sites' => [
'9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d'
]
]),
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://v1.api.altostrat.io/content/bgp/policy/{policyId}"
payload := strings.NewReader("{\n \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\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://v1.api.altostrat.io/content/bgp/policy/{policyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://v1.api.altostrat.io/content/bgp/policy/{policyId}")
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 \"name\": \"High-Risk Geo-IP Block\",\n \"enabled\": true,\n \"lists\": [\n \"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c\"\n ],\n \"sites\": [\n \"9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "9b1d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8b",
"name": "Block Known Threats",
"enabled": true,
"default": false,
"lists": [
"9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"
],
"site_count": 3,
"updated_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}{
"type": "invalid_request_error",
"code": "parameter_invalid",
"message": "The 'name' parameter cannot be empty.",
"doc_url": "https://docs.altostrat.io/errors/parameter_invalid"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the BGP policy to update.
Body
A human-readable name for the policy.
"High-Risk Geo-IP Block"
Whether the policy is active.
true
A list of BGP IP reputation list IDs to include in this policy.
["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"]
A list of site IDs to which this policy should be attached. Any sites not in this list will be detached.
["9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"]
Response
The BGP policy was updated successfully.
"9b1d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8b"
"Block Known Threats"
true
True if this is the default policy for the account.
false
A list of BGP IP reputation list IDs included in this policy.
["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"]
The number of sites currently using this policy.
3
Was this page helpful?