curl --request PUT \
--url https://api-dev.narrative.io/v2/views/{view_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "updated name",
"tags": [
"tag3"
]
}
'import requests
url = "https://api-dev.narrative.io/v2/views/{view_id}"
payload = {
"name": "updated name",
"tags": ["tag3"]
}
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({name: 'updated name', tags: ['tag3']})
};
fetch('https://api-dev.narrative.io/v2/views/{view_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/views/{view_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([
'name' => 'updated name',
'tags' => [
'tag3'
]
]),
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/views/{view_id}"
payload := strings.NewReader("{\n \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\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/views/{view_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/views/{view_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 \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
]
}
}Updates a view
Updates a view
curl --request PUT \
--url https://api-dev.narrative.io/v2/views/{view_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "updated name",
"tags": [
"tag3"
]
}
'import requests
url = "https://api-dev.narrative.io/v2/views/{view_id}"
payload = {
"name": "updated name",
"tags": ["tag3"]
}
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({name: 'updated name', tags: ['tag3']})
};
fetch('https://api-dev.narrative.io/v2/views/{view_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/views/{view_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([
'name' => 'updated name',
'tags' => [
'tag3'
]
]),
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/views/{view_id}"
payload := strings.NewReader("{\n \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\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/views/{view_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.narrative.io/v2/views/{view_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 \"name\": \"updated name\",\n \"tags\": [\n \"tag3\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
View identifier.
Body
It should be unique. Must be <= 256 characters and consist of only alphanumeric characters and underscores.
Optional. Display Name must be non-empty and less than 1000 chars.
Optional. Each tag must be less than 256 chars.
Describes who can view or query a resource
Show child attributes
Show child attributes
Response
OK
- Option 1
- Option 2
It should be unique. Must be <= 256 characters and consist of only alphanumeric characters and underscores.
Describes who can view or query a resource
Show child attributes
Show child attributes
Information about the owner of the view
Show child attributes
Show child attributes
Metadata about when and by whom a view was created/updated
Show child attributes
Show child attributes
Optional. Display Name must be non-empty and less than 1000 chars.
Optional. Each tag must be less than 256 chars.
Whether the requestor owns the view.
NQL schema for the view.
Was this page helpful?

