Skip to main content
PUT
/
content
/
bgp
/
policy
/
{policyId}
Update a BGP Policy
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

policyId
string<uuid>
required

The unique identifier of the BGP policy to update.

Body

application/json
name
string
required

A human-readable name for the policy.

Example:

"High-Risk Geo-IP Block"

enabled
boolean
required

Whether the policy is active.

Example:

true

lists
string<uuid>[]
required

A list of BGP IP reputation list IDs to include in this policy.

Example:
["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"]
sites
string<uuid>[]

A list of site IDs to which this policy should be attached. Any sites not in this list will be detached.

Example:
["9a9d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8d"]

Response

The BGP policy was updated successfully.

id
string<uuid>
read-only
Example:

"9b1d3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8b"

name
string
Example:

"Block Known Threats"

enabled
boolean
Example:

true

default
boolean
read-only

True if this is the default policy for the account.

Example:

false

lists
string<uuid>[]

A list of BGP IP reputation list IDs included in this policy.

Example:
["9b1e3e6a-5c3a-4f1e-9a0a-2b2a1e1d8e8c"]
site_count
integer
read-only

The number of sites currently using this policy.

Example:

3

updated_at
string<date-time>
read-only
created_at
string<date-time>
read-only