Skip to content

Instantly share code, notes, and snippets.

@ashx3s
Last active March 20, 2024 21:46
Show Gist options
  • Save ashx3s/33919359904d6c8edcfa7461213b055a to your computer and use it in GitHub Desktop.
Save ashx3s/33919359904d6c8edcfa7461213b055a to your computer and use it in GitHub Desktop.
Supabase Fetch Using Postman

Fetch from Supabase using Postman

While our apps will have these fetch calls written in javascript, we can start experimenting with data queries using postman or any other api endpoint testing tool.

Note that you can use any filtering techniques that SQL has to offer

Fetch Data with RLS Disabled

RLS (Row Level Security) is the approach that supabase uses to protect tables. Even when RLS is disabled, you still need a secure token in order to query data.

Required Information to Fetch Data

Find these in the Project Settings / API tab

  • The public anon api key
  • The project endpoint

Where to find Query Syntax

  • In the API Docs Tab, find code snippits in Javascript and Bash (the bash ones contain endpoints that you can use)
  • your queries would look something like (this one selects all the blog titles):
https://qutbudvmcbuqapdgtegd.supabase.co/rest/v1/blog?select=title

Api key

  • in the headers field, add the key apikey and then add the public anon key from settings to the value field
  • Note: later when you have more authentication steps involved such as user auth, you'll need to also have a Bearer token.

Practice

  1. Fetch all columns from a table
  2. Fetch only a few columns from a table
  3. Filter the columns with WHERE in your query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment