curl --request GET \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}"
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}', 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}",
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}"
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}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/access-rules/{access_rule_id}")
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{
"name": "access_rule_ebc86610_0907_4374_8fc9_be360f0ff8d0",
"id": 1,
"company_id": 1,
"company_name": "company",
"company_slug": "company_slug_60a4e678_1d56_48a7_8b8b_4e1d689b11a6",
"data_plane_id": "f79cbdae-4848-47ca-95e8-69588364d185",
"display_name": "display name",
"description": "description",
"image": "https://narrative.test/1.png",
"status": "active",
"tags": [
"_nio_access_rule"
],
"nql": "select company_data.\"1\".columnA from company_data.\"1\" WHERE columnA = columnB",
"schema": {
"type": "object",
"properties": {
"columnA": {
"display_name": "columnA",
"type": "string"
}
},
"required": [
"columnA"
]
},
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [
789
]
},
"view": {
"type": "all"
}
},
"price_cpm_usd": 1000.054,
"metadata": {
"created_at": "2023-12-14T21:36:51.847901",
"created_by": 42,
"updated_at": "2023-12-14T21:36:51.847901",
"updated_by": null
},
"dataset_ids": [
42
],
"type": "owned",
"is_owned": true,
"mappings": [
{
"attribute_id": 42,
"attribute_name": "id",
"properties": [
"id.type",
"id.value"
]
}
]
}"<string>"Get an Access Rule by id (V2)
Get an access rule. Authentication is optional: without a token only rules that are visible to unauthenticated users can be read, always in their shared form.
curl --request GET \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}"
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}', 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}",
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}"
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}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/access-rules/{access_rule_id}")
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{
"name": "access_rule_ebc86610_0907_4374_8fc9_be360f0ff8d0",
"id": 1,
"company_id": 1,
"company_name": "company",
"company_slug": "company_slug_60a4e678_1d56_48a7_8b8b_4e1d689b11a6",
"data_plane_id": "f79cbdae-4848-47ca-95e8-69588364d185",
"display_name": "display name",
"description": "description",
"image": "https://narrative.test/1.png",
"status": "active",
"tags": [
"_nio_access_rule"
],
"nql": "select company_data.\"1\".columnA from company_data.\"1\" WHERE columnA = columnB",
"schema": {
"type": "object",
"properties": {
"columnA": {
"display_name": "columnA",
"type": "string"
}
},
"required": [
"columnA"
]
},
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [
789
]
},
"view": {
"type": "all"
}
},
"price_cpm_usd": 1000.054,
"metadata": {
"created_at": "2023-12-14T21:36:51.847901",
"created_by": 42,
"updated_at": "2023-12-14T21:36:51.847901",
"updated_by": null
},
"dataset_ids": [
42
],
"type": "owned",
"is_owned": true,
"mappings": [
{
"attribute_id": 42,
"attribute_name": "id",
"properties": [
"id.type",
"id.value"
]
}
]
}"<string>"Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Access rule identifier.
Response
OK
- Option 1
- Option 2
An access rule as seen by the caller. The owning company gets the full rule (type is owned); everyone
else, including unauthenticated callers, gets the reduced shared form.
Unique identifier for the access rule.
The id of an existing company
345
Name of the company that owns this rule.
The data plane the access rule belongs to. A rule can only be queried from this data plane.
Status of the access rule. Archived rules are never returned by the read endpoints, so this is
active everywhere except the response to the update that archives the rule.
archived, active Optional. _nio_access_rule will be added even if not presented. Access Rule tag must be non-empty and less than 256 chars.
Describes who can view or query a resource
Show child attributes
Show child attributes
How much to charge for a row which matches this access rule. Cost per mille (CPM), more commonly called “cost per thousand,” is how much a buyer pays for 1,000 records.
x >= 0All datasets that were used to form the data.
When the access rule was created and last updated, and by whom. Only the owning company sees the user ids.
Show child attributes
Show child attributes
Indicates the ownership of the access rule.
owned Always true for an owned rule.
true Attributes that are mapped to columns referenced by this access rule. For each mapped
attribute, properties lists the attribute property paths that are exposed by the rule.
Show child attributes
Show child attributes
It should be unique. Also should not intersect with Dataset names. Must be <= 256 characters and consist of only alphanumeric characters and underscores.
Optional. Unique slug assigned to company.
Optional. Display Name must be non-empty and less than 1000 chars.
A human-friendly description of the access rule.
Optional. Image url must be < 1000 characters, start from https://, ends with one of: jpg, apng, jpeg, jfif, pjpeg, webp, pjp, svg, avif, png, gif, bmp, tiff
NQL query of access rule.
Schema describing a structure of View (Access Rule). When the rule exposes mapped attributes, they are
described under properties._rosetta_stone.
Was this page helpful?

