List OPA rules.
curl --request GET \
--url https://{tenant}/api/org/opa \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/org/opa"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/org/opa', 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://{tenant}/api/org/opa",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/org/opa"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/org/opa")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/org/opa")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"open_policy": {
"rules": "package dashboard_users\ndefault request_intent = \"read\"\nrequest_intent = \"write\" { input.request.method == \"POST\" }\nrequest_intent = \"write\" { input.request.method == \"PUT\" }\nrequest_intent = \"delete\" { input.request.method == \"DELETE\" }\ndeny[\"You cannot create a keyless API.\"] {\n request_intent == \"write\"\n contains(input.request.path, \"api/apis\")\n input.request.body.api_definition.use_keyless == true\n}"
}
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Your license does not support Open Policy.",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to identify organisation.",
"Meta": null,
"Status": "Error"
}Open Policy Agent
List OPA rules.
List your organisation OPA rules.
GET
/
api
/
org
/
opa
List OPA rules.
curl --request GET \
--url https://{tenant}/api/org/opa \
--header 'Authorization: Bearer <token>'import requests
url = "https://{tenant}/api/org/opa"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://{tenant}/api/org/opa', 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://{tenant}/api/org/opa",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/api/org/opa"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{tenant}/api/org/opa")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/org/opa")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"open_policy": {
"rules": "package dashboard_users\ndefault request_intent = \"read\"\nrequest_intent = \"write\" { input.request.method == \"POST\" }\nrequest_intent = \"write\" { input.request.method == \"PUT\" }\nrequest_intent = \"delete\" { input.request.method == \"DELETE\" }\ndeny[\"You cannot create a keyless API.\"] {\n request_intent == \"write\"\n contains(input.request.path, \"api/apis\")\n input.request.body.api_definition.use_keyless == true\n}"
}
}{
"Message": "Not authorised",
"Meta": null,
"Status": "Error"
}{
"Message": "Your license does not support Open Policy.",
"Meta": null,
"Status": "Error"
}{
"Message": "Failed to identify organisation.",
"Meta": null,
"Status": "Error"
}Was this page helpful?
⌘I