rest over tables

each table gets a web address. a program with a briven key can read and change rows without writing sql. this is the first floor — not neon's browser data api.

what this is

Point a PostgREST-shaped helper at https://briven.tech/api/v1/rest and add the table name. SQL-over-HTTP at /api/v1/sql stays; this door does not replace it.

Programs only. Briven tables do not have per-row locks, and Briven sign-in is not login for your app's users. A website must not call this door.

read

bash

curl -sS "https://briven.tech/api/v1/rest/notes?select=id,title&id=eq.1&order=title.asc&limit=10" \
  -H "Authorization: Bearer $BRIVEN_API_KEY" \
  -H "Briven-Database: notes"

write

bash

curl -sS -X POST https://briven.tech/api/v1/rest/notes \
  -H "Authorization: Bearer $BRIVEN_API_KEY" \
  -H "Briven-Database: notes" \
  -H "Content-Type: application/json" \
  -H "Prefer: return=representation" \
  -d '{"title":"hello"}'

PATCH and DELETE take the same filters as GET. Without id=eq.1 (or another eq) they are refused.

this floor

  • GETread rows. query: select, eq, order, limit.
  • POSTinsert one JSON object, or an array of objects. 201.
  • PATCHchange rows. must include a filter, for example id=eq.1.
  • DELETEremove rows. must include a filter. deleting every row by accident is refused.
  • AuthorizationBearer brk_… — the same key as SQL-over-HTTP.
  • Briven-Databaserequired when the key is not tied to one database. pinned keys do not need it. we never guess.
  • Preferreturn=representation to get the written rows back. otherwise POST returns rowCount and PATCH/DELETE return 204.

not this floor

  • like, in, or, noteq only, this sitting.
  • offsetuse limit.
  • nested joins / embedslater floor. the URL stays.
  • RPClater floor.
  • OpenAPI bookletlater floor.
  • CORS / browsersthere are no CORS headers. a key that works from a web page is a key given to every visitor.