# Write a block
curl -X PUT https://api.batenbase.com/blocks/user:alice \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"data": {"name": "Alice", "role": "admin"}}'
# Read a block
curl https://api.batenbase.com/blocks/user:alice \
-H "Authorization: Bearer YOUR_TOKEN"
# Scan by prefix
curl "https://api.batenbase.com/blocks?prefix=user:&limit=50" \
-H "Authorization: Bearer YOUR_TOKEN"
const TOKEN = "YOUR_TOKEN";
const BASE = "https://api.batenbase.com";
// Write
await fetch(`${BASE}/blocks/user:alice`, {
method: "PUT",
headers: { "Authorization": `Bearer ${TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify({ data: { name: "Alice" } })
});
// Read
const block = await fetch(`${BASE}/blocks/user:alice`, {
headers: { "Authorization": `Bearer ${TOKEN}` }
}).then(r => r.json());
import requests
TOKEN = "YOUR_TOKEN"
BASE = "https://api.batenbase.com"
HDR = {"Authorization": f"Bearer {TOKEN}"}
# Write
requests.put(f"{BASE}/blocks/user:alice", headers=HDR,
json={"data": {"name": "Alice"}})
# Read
block = requests.get(f"{BASE}/blocks/user:alice", headers=HDR).json()
use reqwest::Client;
let client = Client::new();
let token = "YOUR_TOKEN";
// Write
client.put("https://api.batenbase.com/blocks/user:alice")
.bearer_auth(token)
.json(&serde_json::json!({ "data": { "name": "Alice" } }))
.send().await?;
// Read
let block: serde_json::Value = client
.get("https://api.batenbase.com/blocks/user:alice")
.bearer_auth(token)
.send().await?.json().await?;