Skip to main content
PUT
/
v2
/
access-rules
/
{access_rule_id}
Update an Access Rule by id (V2)
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"
    }
  }
}
'
{
  "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",
  "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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

access_rule_id
integer
required

Access rule identifier.

Body

application/json
name
string

It should be unique. Also should not intersect with Dataset names. Must be <= 256 characters and consist of only alphanumeric characters and underscores.

displayName
string

Optional. Display Name must be non-empty and less than 1000 chars.

description
string

A human-friendly description of the access rule.

tags
string[]

Optional. _nio_access_rule will be added even if not presented. Access Rule tag must be non-empty and less than 256 chars.

collaborators
object

Describes who can view or query a resource

image
string

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

status
enum<string>

Current status of access rule: Active, Archieved

Available options:
archived,
active
priceCpmUsd
number<double>

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

id
integer
required

Unique identifier for the access rule.

company_id
integer<int64>
required

The id of an existing company

Example:

345

company_name
string
required

Name of the company that owns this rule.

status
enum<string>
required

Indicates the status of the access rule.

At the moment the only valid status is active.

Available options:
active
price_cpm_usd
number<double>
required

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.

metadata
object
required

An NQL policy describing which columns of which datasets are targeted by an access rule

type
enum<string>
required

Indicates the ownership of the access rule.

Available options:
owned
mappings
object[]
required

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.

name
string

It should be unique. Also should not intersect with Dataset names. Must be <= 256 characters and consist of only alphanumeric characters and underscores.

company_slug
string

Optional. Unique slug assigned to company.

display_name
string

Optional. Display Name must be non-empty and less than 1000 chars.

description
string

A human-friendly description of the access rule.

image
string

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

tags
string[]

Optional. _nio_access_rule will be added even if not presented. Access Rule tag must be non-empty and less than 256 chars.

nql
string

NQL query of access rule.

schema
object

Schema describing a structure of View (Access Rule)

collaborators
object

Describes who can view or query a resource

dataset_ids
integer<int64>[]

All datasets that were used to form the data.

is_owned
boolean

Indicates if the query is owned by the user's own company.