How to do HTTP Request on the mart scheme?

Hi everyone, I have a table mart.dim_product inside a custom schema mart. The schema is included in pgrst.schemas (public,mart), and I’ve granted full privileges (USAGE, SELECT, etc.) to postgres, service_role, and authenticated. However, the Supabase REST API still returns "relation 'public.dim_product' does not exist" — it seems PostgREST doesn’t recognize the table in the mart schema even though the configuration looks correct. Restarting the project and running NOTIFY pgrst, 'reload schema'; didn’t help. Any ideas why the REST API can’t access tables outside the public schema?
9 Replies
garyaustin
garyaustin3d ago
Goto Data API settings. Add schema to be API accessible. EDIT: I see you are trying to set pgrst.schemas. How did you set that or think your are? What is the error?
harun
harunOP3d ago
I added the schema to in the settings thank you. https://<SUPABASE_PROJECT_URL>/rest/v1/dim_product Is the URL right or do I need to integrate the schema into the URL?
No description
garyaustin
garyaustin3d ago
What is your query on that? Yes you do have to use .schema()
harun
harunOP3d ago
URL: https://<SUPABASE_PROJECT_URL>/rest/v1/dim_product Header (Authorization and apikey) Should I add it in the URL or query?
garyaustin
garyaustin3d ago
If you are generating the http request directly, it is more complicated. You have to set some header. Supabase-js and the other clients handle that for you with .schema().
harun
harunOP3d ago
No I wanted to use it directly via HTTP
garyaustin
garyaustin3d ago
PostgREST 14
Schemas
PostgREST can expose a single or multiple schema’s tables, views and functions. The active database role must have the usage privilege on the schemas to access them. Single schema: To expose a single schema, specify a single value in db-schemas. This schema is added to the search_path of every re...
garyaustin
garyaustin3d ago
There are two different headers depending on your request type. If you plan on using the REST API directly you will need to refer to that site often.
harun
harunOP3d ago
Perfect, thank you so much. I solved it.

Did you find this page helpful?