curl --request POST \
--url https://api.vectorshift.ai/v1/object-model/changes/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cursor": "",
"exclude_facts": true,
"record_filter": {
"kinds": [
"updated"
],
"transitions": [
{
"after": "won",
"field_id": "stage"
}
]
}
}
'import requests
url = "https://api.vectorshift.ai/v1/object-model/changes/query"
payload = {
"cursor": "",
"exclude_facts": True,
"record_filter": {
"kinds": ["updated"],
"transitions": [
{
"after": "won",
"field_id": "stage"
}
]
}
}
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({
cursor: '',
exclude_facts: true,
record_filter: {kinds: ['updated'], transitions: [{after: 'won', field_id: 'stage'}]}
})
};
fetch('https://api.vectorshift.ai/v1/object-model/changes/query', 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.vectorshift.ai/v1/object-model/changes/query",
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([
'cursor' => '',
'exclude_facts' => true,
'record_filter' => [
'kinds' => [
'updated'
],
'transitions' => [
[
'after' => 'won',
'field_id' => 'stage'
]
]
]
]),
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.vectorshift.ai/v1/object-model/changes/query"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\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.vectorshift.ai/v1/object-model/changes/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vectorshift.ai/v1/object-model/changes/query")
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 \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"events": [
{
"fact": {
"asserted_at": "2023-11-07T05:31:56Z",
"asserted_by": "<string>",
"asserted_by_label": "<string>",
"axis_values": {},
"derived": true,
"fact_id": "<string>",
"note": "<string>",
"quantity_id": "<string>",
"retracted": true,
"seq": "<string>",
"source_channel": "<string>",
"source_kind": "<string>",
"subject_id": "<string>",
"subject_label": "<string>",
"superseded_count": 123,
"valid_from": "2023-11-07T05:31:56Z",
"valid_to": "2023-11-07T05:31:56Z",
"value": 123,
"verified": true,
"world_id": "<string>"
},
"kind": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"record": {
"actor_id": "<string>",
"actor_kind": "<string>",
"actor_label": "<string>",
"attributes": [
{
"after": "<unknown>",
"before": "<unknown>",
"id": "<string>",
"label": "<string>",
"storage": "<string>",
"unit": "<string>"
}
],
"author_id": "<string>",
"author_label": "<string>",
"kind": "<string>",
"recorded_at": "2023-11-07T05:31:56Z",
"relationships": [
{
"after": [
"<string>"
],
"before": [
"<string>"
],
"id": "<string>"
}
],
"revision": "<string>",
"type_id": "<string>",
"via": "<string>"
},
"record_id": "<string>",
"removal": {
"fact_id": "<string>",
"quantity_id": "<string>",
"reason": "<string>",
"removed_by": "<string>",
"seq": "<string>",
"subject_id": "<string>",
"world_id": "<string>"
},
"type_id": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}Query changes
The change feed with every record filter, including a field’s change from one value to another. Fact events are not filtered. A filtered page can hold fewer events than limit, even none, while has_more is set: keep reading from next_cursor.
Not taken on this route yet, until how they combine is published: head (400 unsupported_parameter).
curl --request POST \
--url https://api.vectorshift.ai/v1/object-model/changes/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cursor": "",
"exclude_facts": true,
"record_filter": {
"kinds": [
"updated"
],
"transitions": [
{
"after": "won",
"field_id": "stage"
}
]
}
}
'import requests
url = "https://api.vectorshift.ai/v1/object-model/changes/query"
payload = {
"cursor": "",
"exclude_facts": True,
"record_filter": {
"kinds": ["updated"],
"transitions": [
{
"after": "won",
"field_id": "stage"
}
]
}
}
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({
cursor: '',
exclude_facts: true,
record_filter: {kinds: ['updated'], transitions: [{after: 'won', field_id: 'stage'}]}
})
};
fetch('https://api.vectorshift.ai/v1/object-model/changes/query', 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.vectorshift.ai/v1/object-model/changes/query",
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([
'cursor' => '',
'exclude_facts' => true,
'record_filter' => [
'kinds' => [
'updated'
],
'transitions' => [
[
'after' => 'won',
'field_id' => 'stage'
]
]
]
]),
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.vectorshift.ai/v1/object-model/changes/query"
payload := strings.NewReader("{\n \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\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.vectorshift.ai/v1/object-model/changes/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vectorshift.ai/v1/object-model/changes/query")
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 \"cursor\": \"\",\n \"exclude_facts\": true,\n \"record_filter\": {\n \"kinds\": [\n \"updated\"\n ],\n \"transitions\": [\n {\n \"after\": \"won\",\n \"field_id\": \"stage\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"events": [
{
"fact": {
"asserted_at": "2023-11-07T05:31:56Z",
"asserted_by": "<string>",
"asserted_by_label": "<string>",
"axis_values": {},
"derived": true,
"fact_id": "<string>",
"note": "<string>",
"quantity_id": "<string>",
"retracted": true,
"seq": "<string>",
"source_channel": "<string>",
"source_kind": "<string>",
"subject_id": "<string>",
"subject_label": "<string>",
"superseded_count": 123,
"valid_from": "2023-11-07T05:31:56Z",
"valid_to": "2023-11-07T05:31:56Z",
"value": 123,
"verified": true,
"world_id": "<string>"
},
"kind": "<string>",
"occurred_at": "2023-11-07T05:31:56Z",
"record": {
"actor_id": "<string>",
"actor_kind": "<string>",
"actor_label": "<string>",
"attributes": [
{
"after": "<unknown>",
"before": "<unknown>",
"id": "<string>",
"label": "<string>",
"storage": "<string>",
"unit": "<string>"
}
],
"author_id": "<string>",
"author_label": "<string>",
"kind": "<string>",
"recorded_at": "2023-11-07T05:31:56Z",
"relationships": [
{
"after": [
"<string>"
],
"before": [
"<string>"
],
"id": "<string>"
}
],
"revision": "<string>",
"type_id": "<string>",
"via": "<string>"
},
"record_id": "<string>",
"removal": {
"fact_id": "<string>",
"quantity_id": "<string>",
"reason": "<string>",
"removed_by": "<string>",
"seq": "<string>",
"subject_id": "<string>",
"world_id": "<string>"
},
"type_id": "<string>"
}
],
"has_more": true,
"next_cursor": "<string>"
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}{
"code": "<string>",
"error": "<string>",
"status": "failed",
"details": {},
"path": "<string>",
"request_id": "<string>",
"result": {}
}Authorizations
An API key issued with object_model scopes: Authorization: Bearer sk_…. The scopes: object_model:records:read, object_model:records:write, object_model:facts:read, object_model:facts:write, object_model:model:read, object_model:model:configure, object_model:actions:run, object_model:changes:read. An operation's security lists the scopes it needs; several entries mean any one of them will do. A person field (ref(user), ref_list(user)) holds a user id: look people up by email or id with GET /v1/users, outside this API, with a key that also has users:read.
Body
What POST /changes/query takes. Not taken on this route yet, until how they combine is published: head (400 unsupported_parameter).
