Create an object view
curl --request POST \
--url https://api.attio.com/v2/objects/{object}/views \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"title": "Leads",
"type": "table",
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
]
}
}
'import requests
url = "https://api.attio.com/v2/objects/{object}/views"
payload = { "data": {
"title": "Leads",
"type": "table",
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
title: 'Leads',
type: 'table',
filter: {attribute: 'name', op: 'contains', value: 'Ada'},
sorts: [{attribute: 'name', field: 'last_name', direction: 'asc'}],
attributes: [{attribute: 'name', field: 'first_name'}]
}
})
};
fetch('https://api.attio.com/v2/objects/{object}/views', 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.attio.com/v2/objects/{object}/views",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'title' => 'Leads',
'type' => 'table',
'filter' => [
'attribute' => 'name',
'op' => 'contains',
'value' => 'Ada'
],
'sorts' => [
[
'attribute' => 'name',
'field' => 'last_name',
'direction' => 'asc'
]
],
'attributes' => [
[
'attribute' => 'name',
'field' => 'first_name'
]
]
]
]),
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.attio.com/v2/objects/{object}/views"
payload := strings.NewReader("{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.attio.com/v2/objects/{object}/views")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/objects/{object}/views")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"view_id": "cf7aaeb5-7507-4a84-9c26-9d36e34d7b70"
},
"title": "All people",
"created_at": "2022-11-21T13:22:49.061281000Z",
"type": "table",
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
],
"metadata": {
"41252299-f8c7-4b5e-99c9-4ff8321d2f96": {
"kind": "attribute",
"title": "Name",
"api_slug": "name"
}
},
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"kanban": {
"status_attribute": [
"company",
{
"object": "companies",
"attribute": "name"
}
],
"show_no_status_column": true,
"attribute_label_display": "icon",
"aggregation": {
"attribute": "deal_value",
"type": "sum"
}
}
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "unknown_attribute",
"message": "No attribute matches \"nickname\" on this object",
"path": [
"data",
"filter",
"attribute"
]
}{
"status_code": 403,
"type": "auth_error",
"code": "unauthorized",
"message": "You do not have the necessary permissions to create views of this object."
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "The referenced object was not found."
}Views
Create an object view
Creates a view of an object with a filter, sorts, shown attributes and kanban settings. Attributes, objects, options and statuses can be referenced by slug, ID or title; the response references them by ID, as the get view endpoint does.
This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
Required scopes: view:read-write, object_configuration:read.
Supported token levels: workspace, user.
POST
/
v2
/
objects
/
{object}
/
views
Create an object view
curl --request POST \
--url https://api.attio.com/v2/objects/{object}/views \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"title": "Leads",
"type": "table",
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
]
}
}
'import requests
url = "https://api.attio.com/v2/objects/{object}/views"
payload = { "data": {
"title": "Leads",
"type": "table",
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {
title: 'Leads',
type: 'table',
filter: {attribute: 'name', op: 'contains', value: 'Ada'},
sorts: [{attribute: 'name', field: 'last_name', direction: 'asc'}],
attributes: [{attribute: 'name', field: 'first_name'}]
}
})
};
fetch('https://api.attio.com/v2/objects/{object}/views', 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.attio.com/v2/objects/{object}/views",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
'title' => 'Leads',
'type' => 'table',
'filter' => [
'attribute' => 'name',
'op' => 'contains',
'value' => 'Ada'
],
'sorts' => [
[
'attribute' => 'name',
'field' => 'last_name',
'direction' => 'asc'
]
],
'attributes' => [
[
'attribute' => 'name',
'field' => 'first_name'
]
]
]
]),
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.attio.com/v2/objects/{object}/views"
payload := strings.NewReader("{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.attio.com/v2/objects/{object}/views")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.attio.com/v2/objects/{object}/views")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"data\": {\n \"title\": \"Leads\",\n \"type\": \"table\",\n \"filter\": {\n \"attribute\": \"name\",\n \"op\": \"contains\",\n \"value\": \"Ada\"\n },\n \"sorts\": [\n {\n \"attribute\": \"name\",\n \"field\": \"last_name\",\n \"direction\": \"asc\"\n }\n ],\n \"attributes\": [\n {\n \"attribute\": \"name\",\n \"field\": \"first_name\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": {
"workspace_id": "14beef7a-99f7-4534-a87e-70b564330a4c",
"object_id": "97052eb9-e65e-443f-a297-f2d9a4a7f795",
"view_id": "cf7aaeb5-7507-4a84-9c26-9d36e34d7b70"
},
"title": "All people",
"created_at": "2022-11-21T13:22:49.061281000Z",
"type": "table",
"sorts": [
{
"attribute": "name",
"field": "last_name",
"direction": "asc"
}
],
"attributes": [
{
"attribute": "name",
"field": "first_name"
}
],
"metadata": {
"41252299-f8c7-4b5e-99c9-4ff8321d2f96": {
"kind": "attribute",
"title": "Name",
"api_slug": "name"
}
},
"filter": {
"attribute": "name",
"op": "contains",
"value": "Ada"
},
"kanban": {
"status_attribute": [
"company",
{
"object": "companies",
"attribute": "name"
}
],
"show_no_status_column": true,
"attribute_label_display": "icon",
"aggregation": {
"attribute": "deal_value",
"type": "sum"
}
}
}
}{
"status_code": 400,
"type": "invalid_request_error",
"code": "unknown_attribute",
"message": "No attribute matches \"nickname\" on this object",
"path": [
"data",
"filter",
"attribute"
]
}{
"status_code": 403,
"type": "auth_error",
"code": "unauthorized",
"message": "You do not have the necessary permissions to create views of this object."
}{
"status_code": 404,
"type": "invalid_request_error",
"code": "not_found",
"message": "The referenced object was not found."
}Authorizations
Scopes
Was this page helpful?