curl --request PUT \
--url https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"yamlContent": "version: '1.0'\nname: Updated Security Policy\nscope: PROJECT\npriority: 15\nenabled: true\nprojectIds:\n - 550e8400-e29b-41d4-a716-446655440000\nrules:\n - name: Block Critical\n type: severity\n operator: eq\n value: CRITICAL\n action: block"
}
EOFimport requests
url = "https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}"
payload = { "yamlContent": "version: '1.0'
name: Updated Security Policy
scope: PROJECT
priority: 15
enabled: true
projectIds:
- 550e8400-e29b-41d4-a716-446655440000
rules:
- name: Block Critical
type: severity
operator: eq
value: CRITICAL
action: block" }
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({
yamlContent: 'version: \'1.0\'\nname: Updated Security Policy\nscope: PROJECT\npriority: 15\nenabled: true\nprojectIds:\n - 550e8400-e29b-41d4-a716-446655440000\nrules:\n - name: Block Critical\n type: severity\n operator: eq\n value: CRITICAL\n action: block'
})
};
fetch('https://api-eu.cybedefend.com/organization/{organizationId}/policies/{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://api-eu.cybedefend.com/organization/{organizationId}/policies/{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([
'yamlContent' => 'version: \'1.0\'
name: Updated Security Policy
scope: PROJECT
priority: 15
enabled: true
projectIds:
- 550e8400-e29b-41d4-a716-446655440000
rules:
- name: Block Critical
type: severity
operator: eq
value: CRITICAL
action: block'
]),
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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}"
payload := strings.NewReader("{\n \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.cybedefend.com/organization/{organizationId}/policies/{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 \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"scope": "PROJECT",
"organizationId": "550e8400-e29b-41d4-a716-446655440001",
"name": "Production Security Policy",
"priority": 10,
"config": {
"rules": [],
"exclusions": []
},
"isEnabled": true,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"projectIds": [
"550e8400-e29b-41d4-a716-446655440002"
],
"teamIds": [
"550e8400-e29b-41d4-a716-446655440003"
],
"description": "Security policy for production environment",
"createdBy": "<string>",
"updatedBy": "<string>"
}Update a security policy
curl --request PUT \
--url https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"yamlContent": "version: '1.0'\nname: Updated Security Policy\nscope: PROJECT\npriority: 15\nenabled: true\nprojectIds:\n - 550e8400-e29b-41d4-a716-446655440000\nrules:\n - name: Block Critical\n type: severity\n operator: eq\n value: CRITICAL\n action: block"
}
EOFimport requests
url = "https://api-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}"
payload = { "yamlContent": "version: '1.0'
name: Updated Security Policy
scope: PROJECT
priority: 15
enabled: true
projectIds:
- 550e8400-e29b-41d4-a716-446655440000
rules:
- name: Block Critical
type: severity
operator: eq
value: CRITICAL
action: block" }
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({
yamlContent: 'version: \'1.0\'\nname: Updated Security Policy\nscope: PROJECT\npriority: 15\nenabled: true\nprojectIds:\n - 550e8400-e29b-41d4-a716-446655440000\nrules:\n - name: Block Critical\n type: severity\n operator: eq\n value: CRITICAL\n action: block'
})
};
fetch('https://api-eu.cybedefend.com/organization/{organizationId}/policies/{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://api-eu.cybedefend.com/organization/{organizationId}/policies/{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([
'yamlContent' => 'version: \'1.0\'
name: Updated Security Policy
scope: PROJECT
priority: 15
enabled: true
projectIds:
- 550e8400-e29b-41d4-a716-446655440000
rules:
- name: Block Critical
type: severity
operator: eq
value: CRITICAL
action: block'
]),
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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}"
payload := strings.NewReader("{\n \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\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-eu.cybedefend.com/organization/{organizationId}/policies/{policyId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-eu.cybedefend.com/organization/{organizationId}/policies/{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 \"yamlContent\": \"version: '1.0'\\nname: Updated Security Policy\\nscope: PROJECT\\npriority: 15\\nenabled: true\\nprojectIds:\\n - 550e8400-e29b-41d4-a716-446655440000\\nrules:\\n - name: Block Critical\\n type: severity\\n operator: eq\\n value: CRITICAL\\n action: block\"\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"scope": "PROJECT",
"organizationId": "550e8400-e29b-41d4-a716-446655440001",
"name": "Production Security Policy",
"priority": 10,
"config": {
"rules": [],
"exclusions": []
},
"isEnabled": true,
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"projectIds": [
"550e8400-e29b-41d4-a716-446655440002"
],
"teamIds": [
"550e8400-e29b-41d4-a716-446655440003"
],
"description": "Security policy for production environment",
"createdBy": "<string>",
"updatedBy": "<string>"
}Authorizations
JWT access token.
Body
Full YAML policy definition. Example:
version: '1.0' name: Updated Security Policy description: Updated description scope: PROJECT priority: 15 enabled: true projectIds: - 550e8400-e29b-41d4-a716-446655440000 rules: - name: Block Critical type: severity operator: eq value: CRITICAL action: block
"version: '1.0'\nname: Updated Security Policy\nscope: PROJECT\npriority: 15\nenabled: true\nprojectIds:\n - 550e8400-e29b-41d4-a716-446655440000\nrules:\n - name: Block Critical\n type: severity\n operator: eq\n value: CRITICAL\n action: block"
Response
Policy updated
Policy ID
"550e8400-e29b-41d4-a716-446655440000"
Policy scope
ORGANIZATION, TEAM, PROJECT "PROJECT"
Organization ID the policy belongs to
"550e8400-e29b-41d4-a716-446655440001"
Policy name
"Production Security Policy"
Priority (lower = higher priority)
10
Policy configuration
{ "rules": [], "exclusions": [] }
Whether the policy is enabled
true
Creation timestamp
"2024-01-15T10:30:00Z"
Last update timestamp
"2024-01-15T10:30:00Z"
Project IDs targeted by this policy (for PROJECT scope)
["550e8400-e29b-41d4-a716-446655440002"]
Team IDs targeted by this policy (for TEAM scope)
["550e8400-e29b-41d4-a716-446655440003"]
Policy description
"Security policy for production environment"
User ID who created the policy
User ID who last updated the policy