cURL
curl --request PUT \
--url https://api.opal.dev/v1/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
}
}
'import requests
url = "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload = {
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": { "when": { "clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": ["<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({
name: 'Platform Engineering',
description: 'This access rule represents all platform engineers in the company.',
admin_owner_id: '7c86c85d-0651-43e2-a748-d69d658418e8',
status: 'ACTIVE',
ruleClauses: {
when: {
clauses: [
{
selectors: [
{
key: '<string>',
value: '<string>',
connection_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
attribute_selectors: [{attribute: 'HR_IDP_STATUS', values: ['<string>']}]
}
]
}
}
})
};
fetch('https://api.opal.dev/v1/access-rules/{access_rule_id}', 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.opal.dev/v1/access-rules/{access_rule_id}",
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' => 'Platform Engineering',
'description' => 'This access rule represents all platform engineers in the company.',
'admin_owner_id' => '7c86c85d-0651-43e2-a748-d69d658418e8',
'status' => 'ACTIVE',
'ruleClauses' => [
'when' => [
'clauses' => [
[
'selectors' => [
[
'key' => '<string>',
'value' => '<string>',
'connection_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'attribute_selectors' => [
[
'attribute' => 'HR_IDP_STATUS',
'values' => [
'<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.opal.dev/v1/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\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://api.opal.dev/v1/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/access-rules/{access_rule_id}")
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\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"access_rule_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
},
"unless": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
},
"uses_opal_query": false
}Put access rules
Updates the access rule config for the given group_id.
PUT
/
access-rules
/
{access_rule_id}
cURL
curl --request PUT \
--url https://api.opal.dev/v1/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
}
}
'import requests
url = "https://api.opal.dev/v1/access-rules/{access_rule_id}"
payload = {
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": { "when": { "clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": ["<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({
name: 'Platform Engineering',
description: 'This access rule represents all platform engineers in the company.',
admin_owner_id: '7c86c85d-0651-43e2-a748-d69d658418e8',
status: 'ACTIVE',
ruleClauses: {
when: {
clauses: [
{
selectors: [
{
key: '<string>',
value: '<string>',
connection_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
}
],
attribute_selectors: [{attribute: 'HR_IDP_STATUS', values: ['<string>']}]
}
]
}
}
})
};
fetch('https://api.opal.dev/v1/access-rules/{access_rule_id}', 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.opal.dev/v1/access-rules/{access_rule_id}",
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' => 'Platform Engineering',
'description' => 'This access rule represents all platform engineers in the company.',
'admin_owner_id' => '7c86c85d-0651-43e2-a748-d69d658418e8',
'status' => 'ACTIVE',
'ruleClauses' => [
'when' => [
'clauses' => [
[
'selectors' => [
[
'key' => '<string>',
'value' => '<string>',
'connection_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'attribute_selectors' => [
[
'attribute' => 'HR_IDP_STATUS',
'values' => [
'<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.opal.dev/v1/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\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://api.opal.dev/v1/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/access-rules/{access_rule_id}")
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\": \"Platform Engineering\",\n \"description\": \"This access rule represents all platform engineers in the company.\",\n \"admin_owner_id\": \"7c86c85d-0651-43e2-a748-d69d658418e8\",\n \"status\": \"ACTIVE\",\n \"ruleClauses\": {\n \"when\": {\n \"clauses\": [\n {\n \"selectors\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\",\n \"connection_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ],\n \"attribute_selectors\": [\n {\n \"attribute\": \"HR_IDP_STATUS\",\n \"values\": [\n \"<string>\"\n ]\n }\n ]\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"access_rule_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"name": "Platform Engineering",
"description": "This access rule represents all platform engineers in the company.",
"admin_owner_id": "7c86c85d-0651-43e2-a748-d69d658418e8",
"status": "ACTIVE",
"ruleClauses": {
"when": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
},
"unless": {
"clauses": [
{
"selectors": [
{
"key": "<string>",
"value": "<string>",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
],
"attribute_selectors": [
{
"attribute": "HR_IDP_STATUS",
"values": [
"<string>"
]
}
]
}
]
}
},
"uses_opal_query": false
}Authorizations
Body
application/json
UpdateAccessRuleInfo Object
Description
The UpdateAccessRuleInfo object is used as an input to the UpdateAccessRule and CreateAccessRule API.
Response
200 - application/json
The updated access rule config for the group.
Access Rule Object
Description
The AccessRule object is used to represent an access rule configuration.
Usage Example
List access rules from the GET /access-rules endpoint, or retrieve a single access rule from the GET /access-rules/{access_rule_id} endpoint.
Was this page helpful?