curl --request GET \
--url https://api-dev.narrative.io/v2/queries \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/queries"
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/queries', 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/queries",
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/queries"
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/queries")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/queries")
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{
"prev_page": null,
"current_page": 1,
"next_page": null,
"total_records": 1,
"total_pages": 1,
"records": [
{
"name": "query1",
"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
},
"ast": {
"type": "select",
"nql": "SELECT age FROM narrative.rosetta_stone",
"budget": null,
"columns": [
{
"type": "table",
"nql": "age",
"db": null,
"schema": null,
"table": "age"
}
],
"from": {
"type": "table",
"nql": "narrative.rosetta_stone",
"db": null,
"schema": "narrative",
"table": "rosetta_stone"
},
"group_by": [],
"having": null,
"is_distinct": false,
"limit": null,
"order_by": [],
"qualify": null,
"where": null,
"windows": [],
"with": []
}
}
]
}Get accessible queries
Get all accessible queries.
curl --request GET \
--url https://api-dev.narrative.io/v2/queries \
--header 'Authorization: Bearer <token>'import requests
url = "https://api-dev.narrative.io/v2/queries"
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/queries', 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/queries",
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/queries"
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/queries")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/queries")
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{
"prev_page": null,
"current_page": 1,
"next_page": null,
"total_records": 1,
"total_pages": 1,
"records": [
{
"name": "query1",
"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
},
"ast": {
"type": "select",
"nql": "SELECT age FROM narrative.rosetta_stone",
"budget": null,
"columns": [
{
"type": "table",
"nql": "age",
"db": null,
"schema": null,
"table": "age"
}
],
"from": {
"type": "table",
"nql": "narrative.rosetta_stone",
"db": null,
"schema": "narrative",
"table": "rosetta_stone"
},
"group_by": [],
"having": null,
"is_distinct": false,
"limit": null,
"order_by": [],
"qualify": null,
"where": null,
"windows": [],
"with": []
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
If true returns only queries that are owned by the requestor. If false returns only queries that have been shared with the requestor. If not provided returns both.
Filters queries that are tagged with tag. Can appear multiple times, in which case they're OR-d together
Number of page. Stars from the first (1) page.
Number of records to return.
Response
OK
- Option 1
- Option 2
Show child attributes
Show child attributes
{
"name": "query1",
"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
},
"ast": {
"type": "select",
"nql": "SELECT age FROM narrative.rosetta_stone",
"budget": null,
"columns": [
{
"type": "table",
"nql": "age",
"db": null,
"schema": null,
"table": "age"
}
],
"from": {
"type": "table",
"nql": "narrative.rosetta_stone",
"db": null,
"schema": "narrative",
"table": "rosetta_stone"
},
"group_by": [],
"having": null,
"is_distinct": false,
"limit": null,
"order_by": [],
"qualify": null,
"where": null,
"windows": [],
"with": []
}
}
The number of previous page (if exists). Also can refer to the latest existing page if non-existing page was requested.
1
The number of requested page.
1
The number of next page (if exists).
42
Total amount of accessible Access Rules
15000
Total amount of pages.
10
Was this page helpful?

