curl --request PUT \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"display_name": "Updated Access Rule",
"description": "This is an updated description for the access rule.",
"image": "http://example.com/updated_image.png",
"status": "inactive",
"tags": [
"updated_tag1",
"updated_tag2"
],
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [
789
]
},
"view": {
"type": "all"
}
}
}
'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}"
payload = {
"display_name": "Updated Access Rule",
"description": "This is an updated description for the access rule.",
"image": "http://example.com/updated_image.png",
"status": "inactive",
"tags": ["updated_tag1", "updated_tag2"],
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [789]
},
"view": { "type": "all" }
}
}
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({
display_name: 'Updated Access Rule',
description: 'This is an updated description for the access rule.',
image: 'http://example.com/updated_image.png',
status: 'inactive',
tags: ['updated_tag1', 'updated_tag2'],
collaborators: {query: {type: 'inclusion', company_ids: [789]}, view: {type: 'all'}}
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'display_name' => 'Updated Access Rule',
'description' => 'This is an updated description for the access rule.',
'image' => 'http://example.com/updated_image.png',
'status' => 'inactive',
'tags' => [
'updated_tag1',
'updated_tag2'
],
'collaborators' => [
'query' => [
'type' => 'inclusion',
'company_ids' => [
789
]
],
'view' => [
'type' => 'all'
]
]
]),
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-dev.narrative.io/v2/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\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-dev.narrative.io/v2/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\n }\n }\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\n }\n }\n}"
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",
"updated_at": "2023-12-14T21:36:51.847901"
},
"dataset_ids": [
42
],
"type": "owned",
"is_owned": true,
"mappings": [
{
"attribute_id": 42,
"attribute_name": "id",
"properties": [
"id.type",
"id.value"
]
}
]
}Update an Access Rule by id (V2)
Update an access rule.
curl --request PUT \
--url https://api-dev.narrative.io/v2/access-rules/{access_rule_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"display_name": "Updated Access Rule",
"description": "This is an updated description for the access rule.",
"image": "http://example.com/updated_image.png",
"status": "inactive",
"tags": [
"updated_tag1",
"updated_tag2"
],
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [
789
]
},
"view": {
"type": "all"
}
}
}
'import requests
url = "https://api-dev.narrative.io/v2/access-rules/{access_rule_id}"
payload = {
"display_name": "Updated Access Rule",
"description": "This is an updated description for the access rule.",
"image": "http://example.com/updated_image.png",
"status": "inactive",
"tags": ["updated_tag1", "updated_tag2"],
"collaborators": {
"query": {
"type": "inclusion",
"company_ids": [789]
},
"view": { "type": "all" }
}
}
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({
display_name: 'Updated Access Rule',
description: 'This is an updated description for the access rule.',
image: 'http://example.com/updated_image.png',
status: 'inactive',
tags: ['updated_tag1', 'updated_tag2'],
collaborators: {query: {type: 'inclusion', company_ids: [789]}, view: {type: 'all'}}
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'display_name' => 'Updated Access Rule',
'description' => 'This is an updated description for the access rule.',
'image' => 'http://example.com/updated_image.png',
'status' => 'inactive',
'tags' => [
'updated_tag1',
'updated_tag2'
],
'collaborators' => [
'query' => [
'type' => 'inclusion',
'company_ids' => [
789
]
],
'view' => [
'type' => 'all'
]
]
]),
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-dev.narrative.io/v2/access-rules/{access_rule_id}"
payload := strings.NewReader("{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\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-dev.narrative.io/v2/access-rules/{access_rule_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\n }\n }\n}")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"display_name\": \"Updated Access Rule\",\n \"description\": \"This is an updated description for the access rule.\",\n \"image\": \"http://example.com/updated_image.png\",\n \"status\": \"inactive\",\n \"tags\": [\n \"updated_tag1\",\n \"updated_tag2\"\n ],\n \"collaborators\": {\n \"query\": {\n \"type\": \"inclusion\",\n \"company_ids\": [\n 789\n ]\n },\n \"view\": {\n \"type\": \"all\"\n }\n }\n}"
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",
"updated_at": "2023-12-14T21:36:51.847901"
},
"dataset_ids": [
42
],
"type": "owned",
"is_owned": true,
"mappings": [
{
"attribute_id": 42,
"attribute_name": "id",
"properties": [
"id.type",
"id.value"
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Access rule identifier.
Body
It should be unique. Also should not intersect with Dataset names. Must be <= 256 characters and consist of only alphanumeric characters and underscores.
Optional. Display Name must be non-empty and less than 1000 chars.
A human-friendly description of the access rule.
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
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
Current status of access rule: Active, Archieved
archived, active 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.
Response
OK
- Option 1
- Option 2
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.
Indicates the status of the access rule.
At the moment the only valid status is active.
active 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.
An NQL policy describing which columns of which datasets are targeted by an access rule
Show child attributes
Show child attributes
Indicates the ownership of the access rule.
owned 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
Optional. _nio_access_rule will be added even if not presented. Access Rule tag must be non-empty and less than 256 chars.
NQL query of access rule.
Schema describing a structure of View (Access Rule)
Describes who can view or query a resource
Show child attributes
Show child attributes
All datasets that were used to form the data.
Indicates if the query is owned by the user's own company.
Was this page helpful?

