curl --request POST \
--url https://api.vainona.ai/v1/namespaces/{ns} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upsert": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"patch": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"append": [
{
"id": "<string>",
"path": "state.messages",
"values": "<array>"
}
],
"delete": [
"<string>"
],
"wait_for": [
"<string>"
],
"wait_timeout_ms": 5000
}
'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}"
payload = {
"upsert": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"patch": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"append": [
{
"id": "<string>",
"path": "state.messages",
"values": "<array>"
}
],
"delete": ["<string>"],
"wait_for": ["<string>"],
"wait_timeout_ms": 5000
}
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({
upsert: [
{id: '<string>', attributes: {}, state: {}, created_at: '2023-11-07T05:31:56Z'}
],
patch: [
{id: '<string>', attributes: {}, state: {}, created_at: '2023-11-07T05:31:56Z'}
],
append: [{id: '<string>', path: 'state.messages', values: '<array>'}],
delete: ['<string>'],
wait_for: ['<string>'],
wait_timeout_ms: 5000
})
};
fetch('https://api.vainona.ai/v1/namespaces/{ns}', 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.vainona.ai/v1/namespaces/{ns}",
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([
'upsert' => [
[
'id' => '<string>',
'attributes' => [
],
'state' => [
],
'created_at' => '2023-11-07T05:31:56Z'
]
],
'patch' => [
[
'id' => '<string>',
'attributes' => [
],
'state' => [
],
'created_at' => '2023-11-07T05:31:56Z'
]
],
'append' => [
[
'id' => '<string>',
'path' => 'state.messages',
'values' => '<array>'
]
],
'delete' => [
'<string>'
],
'wait_for' => [
'<string>'
],
'wait_timeout_ms' => 5000
]),
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.vainona.ai/v1/namespaces/{ns}"
payload := strings.NewReader("{\n \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\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.vainona.ai/v1/namespaces/{ns}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}")
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 \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "<string>",
"revision": 1,
"incarnation": 1,
"answers": {}
}
],
"usage": {
"bytes_written": 1,
"bytes_scanned": 1,
"judgment_units": 1,
"tokens_evaluated": 1
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Write documents (upsert, patch, append, delete)
Operations apply in the order upsert, patch, append, delete and commit atomically for the namespace. A request is never split across two commits. The namespace is created by its first write. See §6.4.
curl --request POST \
--url https://api.vainona.ai/v1/namespaces/{ns} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"upsert": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"patch": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"append": [
{
"id": "<string>",
"path": "state.messages",
"values": "<array>"
}
],
"delete": [
"<string>"
],
"wait_for": [
"<string>"
],
"wait_timeout_ms": 5000
}
'import requests
url = "https://api.vainona.ai/v1/namespaces/{ns}"
payload = {
"upsert": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"patch": [
{
"id": "<string>",
"attributes": {},
"state": {},
"created_at": "2023-11-07T05:31:56Z"
}
],
"append": [
{
"id": "<string>",
"path": "state.messages",
"values": "<array>"
}
],
"delete": ["<string>"],
"wait_for": ["<string>"],
"wait_timeout_ms": 5000
}
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({
upsert: [
{id: '<string>', attributes: {}, state: {}, created_at: '2023-11-07T05:31:56Z'}
],
patch: [
{id: '<string>', attributes: {}, state: {}, created_at: '2023-11-07T05:31:56Z'}
],
append: [{id: '<string>', path: 'state.messages', values: '<array>'}],
delete: ['<string>'],
wait_for: ['<string>'],
wait_timeout_ms: 5000
})
};
fetch('https://api.vainona.ai/v1/namespaces/{ns}', 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.vainona.ai/v1/namespaces/{ns}",
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([
'upsert' => [
[
'id' => '<string>',
'attributes' => [
],
'state' => [
],
'created_at' => '2023-11-07T05:31:56Z'
]
],
'patch' => [
[
'id' => '<string>',
'attributes' => [
],
'state' => [
],
'created_at' => '2023-11-07T05:31:56Z'
]
],
'append' => [
[
'id' => '<string>',
'path' => 'state.messages',
'values' => '<array>'
]
],
'delete' => [
'<string>'
],
'wait_for' => [
'<string>'
],
'wait_timeout_ms' => 5000
]),
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.vainona.ai/v1/namespaces/{ns}"
payload := strings.NewReader("{\n \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\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.vainona.ai/v1/namespaces/{ns}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vainona.ai/v1/namespaces/{ns}")
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 \"upsert\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"patch\": [\n {\n \"id\": \"<string>\",\n \"attributes\": {},\n \"state\": {},\n \"created_at\": \"2023-11-07T05:31:56Z\"\n }\n ],\n \"append\": [\n {\n \"id\": \"<string>\",\n \"path\": \"state.messages\",\n \"values\": \"<array>\"\n }\n ],\n \"delete\": [\n \"<string>\"\n ],\n \"wait_for\": [\n \"<string>\"\n ],\n \"wait_timeout_ms\": 5000\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "<string>",
"revision": 1,
"incarnation": 1,
"answers": {}
}
],
"usage": {
"bytes_written": 1,
"bytes_scanned": 1,
"judgment_units": 1,
"tokens_evaluated": 1
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "invalid_request",
"message": "<string>",
"details": {}
}
}Authorizations
An organization API key. Keys carry a role (read_write or
read_only) and may be restricted to a namespace prefix such as
acme/*, or to one namespace such as acme/prod/tenant_1. A prefix
matches on a / boundary: acme/prod/tenant_1* covers
acme/prod/tenant_1 and everything under acme/prod/tenant_1/,
never acme/prod/tenant_12.
Headers
Returns the original response verbatim while the node still caches it. Correctness never depends on it.
1Path Parameters
The namespace name, with any / sent as %2F.
Up to 256 bytes. / separates levels of the hierarchy, as in acme/prod/tenant_123.
1 - 256^[A-Za-z0-9._:/-]+$Body
- Option 1
- Option 2
- Option 3
- Option 4
At most 1,000 documents and 64 MB per request, across all operations.
1000Show child attributes
Show child attributes
1000Show child attributes
Show child attributes
1000Show child attributes
Show child attributes
1000Up to 128 bytes.
1 - 128^[A-Za-z0-9._:/-]+$Block until every named judgment has an answer for a revision at or after the one this write created. An empty list is the same as leaving it out. The first 16 documents of the write are judged at interactive priority; the rest go to ordinary catch-up and usually come back pending (§7.3.2).
A judgment, attribute or threshold name. Names are path segments in field references, so they never contain ..
1 - 128^[A-Za-z0-9_-]+$How long wait_for waits, in milliseconds. A value above 10,000 is lowered to 10,000.
x >= 0Response
The write is durable in object storage. With wait_for, answers are
included; on timeout the write is still committed and those answers
are pending, meaning only that they were not ready within the
wait. A get works freshness out from the stored answer, so it can
report the same answer as unavailable (never judged in this
incarnation) or stale (a policy that will not judge this
revision on its own).