Using PostgreSQL functions to call an API with Supabase

preview_player
Показать описание

Functions are a super powerful way to encapsulate some logic in our Postgres database. If we were restricted to only writing SQL statements, these functions would be quite limited. By utilizing database extensions, we can expand this functionality to basically do anything we want!

While this example is quite novel, the same method could be used to perform important core responsibilities of your application - such as charging a customer with Stripe, or sending an SMS with Twilio.

---
Learn more about Supabase 👇

Jon Meyers 👇

---
Рекомендации по теме
Комментарии
Автор

im a dba & ive just moved from ms sql server to postgres. loving it more each day.

mrrolandlawrence
Автор

You are one of my favorite presenters, a total joy to watch and learn from. I feel like you really embody the ethos of Supabase. Thanks for the content 😎

ZalexMusic
Автор

That's amazing! thanks for sharing!

If I use http in a function and call that function from a trigger after INSERT/UPDATE/DELETE, will the function call be async or the INSERT/UPDATE/DELETE will block the SQL till the http request is done?


I am asking because in some scenarios, I am just calling a webhook and don't want to wait for a response because if it takes multiple seconds, this will slow down the DB as more CUDs occur

korayem
Автор

Pleaser update this video as for me it does not work. Can you please send a real life payload example with realistic data and Auth in headers pls. Kanye aint cutting it at all! I followed this and its a no go, plus I can't find any online examples with syntax for actual realistic JSON RAW payloads and headers.

AssassinUK
Автор

In case we're you may hit api rate limits when requesting external IP address, in this case the Kanye quote api. Is there any work around like addition IP or other.

TradePlanIO
Автор

for the love of god, i cannot get why this does not work.
I am trying to call with a post call with a json body. I would love to see a test done with this, extensions added to the path.. dunno what to do anymore... i want to create a stripe customer directly in a function call, in order not to mess with edge functions.

dogscarpb
Автор

http_get doesn't work - whatever I tried. I installed 'http' extension into extensions schema, then created http schema and installed the 'http' into that too, http_get doesn't work. Neither does http.http_get This tutorial is probably outdated and there's no decent tutorial on the web on how to create Functions that do external GET requests.

garenkarapetian
Автор

is there a good way to call a supabase REST API within a function?
I'm thinking of the "invite" REST API which requires the SUPABASE SECRET instead of the anon.

tomtom
Автор

This is out of date now. Blocked on which schema to choose, is it "extensions" or "public"

arvindsontha
Автор

Is there a video on how to assign your domain to the db?

humn
Автор

What if the api I am working with requires a key? Where should I give the function the key to access the api?

abdull
Автор

Is it possible to make POST request too?

name-orrx
Автор

I want to add users to my project using api request(post method), it will be a great favor if anyone can help me🥰

anasmadhav
Автор

lol damn but now how do you put all that in a react or Kotlin app?

antdx
Автор

This was totally unrealistic. No antisemitism or "I love Hitler" from the rest api at all.

caynebyron
Автор

This is super limited, if the API requires any kind of authentication then it's game over.

sm
Автор

😂 click the dislike button twice. Thank you for these great tutorials

rishabh_s
Автор

There's free Star Wars API, but yet, you use someone that spit out antisemitism statements, showing hate towards a group of people. Is this what Supabase stands for? I wonder what all those companies that are being displayed on your main website would think about promoting Kanye West in your tutorial videos? Let's find out...

mtnwildernessfamily