http://192.168.43.164:8001/project/default/api?page=tables-intro
Introduction
All views and tables in the public schema and accessible by the active database role for a request are available for querying.
Non-exposed tables
If you don't want to expose tables in your API, simply add them to a different schema (not the public schema).
----------------------------------------------------------------------------
Run this sql for Auto-generated documentation working on schema "btth"
-- (https://github.com/supabase/supabase/issues/11167)
GRANT USAGE ON SCHEMA btth TO postgres, authenticated, service_role, dashboard_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA btth to postgres, authenticated, service_role, dashboard_user;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA btth TO postgres, authenticated, service_role, dashboard_user;
ALTER ROLE authenticator SET pgrst.db_schemas = btth;
NOTIFY pgrst, 'reload config';
NOTIFY pgrst, 'reload schema';
Reopen: http://192.168.43.164:8001/project/default/api (can open dev-tools to get openapi of supabase project)
curl 'http://192.168.43.164:8001/api/projects/default/api/rest' -H 'Authorization: Basic ....' > doc1.json
Reset Auto-generated documentation to schema: "public"
ALTER ROLE authenticator SET pgrst.db_schemas = 'public,btth';
NOTIFY pgrst, 'reload config';
NOTIFY pgrst, 'reload schema';
Convert open api json (doc1.json) to yaml
https://editor.swagger.io/
Trick:
You can gen document auto from response:
http://192.168.43.164:8001/api/pg-meta/default/tables?include_columns=true&included_schemas=btth
http://192.168.43.164:8001/api/pg-meta/default/functions
Comments
Post a Comment