curl --request PUT \
--url https://api.example.com/api/states/{name} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.example.com/api/states/{name}"
headers = {"x-api-key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.example.com/api/states/{name}', 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.example.com/api/states/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.example.com/api/states/{name}"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.example.com/api/states/{name}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/states/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"default_subject_kind": "<string>",
"name": "<string>",
"subject_kinds": [
"<string>"
],
"description": "",
"effective_schema": {},
"regimes": [
{}
],
"retention_days": 1073741823,
"schema": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Create or re-declare a state
Upsert a state declaration; the name is taken from the path. With records present
only additive schema changes are accepted — a narrowing is refused while records exist.
curl --request PUT \
--url https://api.example.com/api/states/{name} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.example.com/api/states/{name}"
headers = {"x-api-key": "<api-key>"}
response = requests.put(url, headers=headers)
print(response.text)const options = {method: 'PUT', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.example.com/api/states/{name}', 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.example.com/api/states/{name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.example.com/api/states/{name}"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.example.com/api/states/{name}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/states/{name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"default_subject_kind": "<string>",
"name": "<string>",
"subject_kinds": [
"<string>"
],
"description": "",
"effective_schema": {},
"regimes": [
{}
],
"retention_days": 1073741823,
"schema": {
"content": "<string>",
"id": "<string>",
"kwargs": {}
},
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}Authorizations
Path Parameters
Response
Success.
A declared state: its name, human description, base JSON schema
(wire key schema, attribute schema_), the subject_kinds it serves
(≥1, unique, each matching :data:SUBJECT_KIND_RE), the default_subject_kind
a door's ambient subject resolves to (one of subject_kinds), and an optional
retention_days (a positive INT4, or unset to keep records forever).
effective_schema is the base schema composed with every attached template's
fragment, and regimes are the absolute write-regime rules composed over the
attachments (each {path, regime}, the attachment path prefixed onto the template's regime
paths). updated_at is the row's last-write timestamp. The platform computes all
three and serves them on every read; a client that supplies a non-None value for
any of them on a write is refused (… is set/computed by the platform), so none can
be forged across the wire.
Show child attributes
Show child attributes

