Skip to main content
GET
/
v2
/
views
Get accessible views
curl --request GET \
  --url https://api-dev.narrative.io/v2/views \
  --header 'Authorization: Bearer <token>'
{
  "prev_page": null,
  "current_page": 1,
  "next_page": null,
  "total_records": 1,
  "total_pages": 1,
  "records": [
    {
      "name": "view1",
      "id": "7409b999-2a9a-40cd-89dc-8430d85e0391",
      "display_name": "View One",
      "owner": {
        "company_id": 456,
        "company_name": "ExampleCorp",
        "company_slug": "examplecorp"
      },
      "tags": [
        "tag1",
        "tag2"
      ],
      "collaborators": {
        "query": {
          "type": "inclusion",
          "company_ids": [
            789
          ]
        },
        "view": {
          "type": "all"
        }
      },
      "is_owned": true,
      "metadata": {
        "created_at": "2024-04-12T19:57:05.012908",
        "created_by_user_id": 321,
        "updated_at": "2024-04-12T20:03:48.031825",
        "updated_by_user_id": 321
      },
      "nql": "SELECT age FROM narrative.rosetta_stone",
      "schema": {
        "type": "object",
        "properties": {
          "age": {
            "display_name": "age",
            "type": "double"
          }
        },
        "required": [
          "id"
        ]
      }
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Query Parameters

is_owned
boolean

If true returns only views that are owned by the requestor. If false returns only views that have been shared with the requestor. If not provided returns both.

tag
string

Filters views that are tagged with tag. Can appear multiple times, in which case they're OR-d together

page
integer

Number of page. Stars from the first (1) page.

per_page
integer

Number of records to return.

Response

200 - application/json

OK

records
object[]
required
Example:
{
"name": "view1",
"id": "7409b999-2a9a-40cd-89dc-8430d85e0391",
"display_name": "Query One",
"owner": {
"company_id": 456,
"company_name": "ExampleCorp",
"company_slug": "examplecorp"
},
"tags": ["tag1", "tag2"],
"collaborators": {
"query": { "type": "inclusion", "company_ids": [789] },
"view": { "type": "all" }
},
"is_owned": true,
"metadata": {
"created_at": "2024-04-12T19:57:05.012908",
"created_by_user_id": 321,
"updated_at": "2024-04-12T20:03:48.031825",
"updated_by_user_id": 321
},
"nql": "SELECT age FROM narrative.rosetta_stone",
"schema": {
"type": "object",
"properties": {
"age": { "display_name": "age", "type": "double" }
},
"required": ["id"]
}
}
prev_page
integer<int64>

The number of previous page (if exists). Also can refer to the latest existing page if non-existing page was requested.

Example:

1

current_page
integer<int64>

The number of requested page.

Example:

1

next_page
integer<int64>

The number of next page (if exists).

Example:

42

total_records
integer<int64>

Total amount of accessible Access Rules

Example:

15000

total_pages
integer<int64>

Total amount of pages.

Example:

10