Get the query policy of an Access Rule
curl --request GET \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy', 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-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy",
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://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy"
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://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy")
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{
"default": {
"projection": {
"mode": "allow",
"scalar_operators": [
"<string>"
],
"aggregate_operators": [
"<string>"
],
"external_operators": [
"<string>"
]
},
"group_by": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
},
"join": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
}
},
"usage_rules": [
{
"attribute": "<string>",
"field": "<string>",
"projection": {
"mode": "allow",
"scalar_operators": [
"<string>"
],
"aggregate_operators": [
"<string>"
],
"external_operators": [
"<string>"
]
},
"group_by": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
},
"join": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
}
}
],
"join_required_rule": {
"match": [
{
"keys": [
{
"form": "raw",
"attribute": "<string>",
"field": "<string>"
}
]
}
]
}
}"<string>"Access Rules
Get the query policy of an Access Rule
Get the query policy attached to an access rule. Any company that can view the rule can read its policy.
GET
/
v2
/
access-rules
/
{access_rule_id}
/
query-policy
Get the query policy of an Access Rule
curl --request GET \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy', 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-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy",
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://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy"
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://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/access-rules/{access_rule_id}/query-policy")
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{
"default": {
"projection": {
"mode": "allow",
"scalar_operators": [
"<string>"
],
"aggregate_operators": [
"<string>"
],
"external_operators": [
"<string>"
]
},
"group_by": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
},
"join": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
}
},
"usage_rules": [
{
"attribute": "<string>",
"field": "<string>",
"projection": {
"mode": "allow",
"scalar_operators": [
"<string>"
],
"aggregate_operators": [
"<string>"
],
"external_operators": [
"<string>"
]
},
"group_by": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
},
"join": {
"mode": "allow",
"scalar_operators": [
"<string>"
]
}
}
],
"join_required_rule": {
"match": [
{
"keys": [
{
"form": "raw",
"attribute": "<string>",
"field": "<string>"
}
]
}
]
}
}"<string>"Authorizations
Response
OK
Limits how a querying company may use the attributes and fields this access rule selects. An attribute is a
Rosetta Stone attribute that the access rule selects from _rosetta_stone. A field is any other column of the
access rule, such as a dataset column it selects directly. A query that breaks the policy reads no rows from the
access rule.

