Hello everyone, I have a function that returns val...
# help
d
Hello everyone, I have a function that returns values. How can I call this function from curl script point of view? I've tried this script but it didn't work
Copy code
curl 'https://cbgccbohphtbbvnoecep.supabase.co/rest/v1/latestOilTracker?select=*' \
-H "apikey: xxx" \
-H "Authorization: Bearer xxx"
In the above script "latestOilTracker" is actually a function
n
Hello @d33pu! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g
If you have a postgres function, you can get the format for the API call in the Dashboard under API tab and 'Bash'...
n
deepu (2022-03-21)
d
interesting it seems like none
the one you shared, is it from documentation?
g
No from my api
your rpc call should work with ....supabase.co/rest/v1/rpc/latestOilTracker' \ if you are not passing parameters.
Although I've never used camel case for Postgres function names....
d
apparently it couldn't find the function and may be this is why I don't see the suggestion that you see on your API
but when I run the function in sql editor, it works
This is the error that throws when I run using cURL
Copy code
{"message":"Could not find the public.latestOilTracker() function or the public.latestOilTracker function with a single unnamed json or jsonb parameter in the schema cache","hint":"If a new function was created in the database with this name and parameters, try reloading the schema cache."
g
probably because you used camel case. It is looking for latestoiltracker(), or visa versa and function name is all lowercase... Not sure how it gets processed.
unless in quotes "" all gets converted to lower case in Postgres.
d
will give a try with lowercase
Thank you that did work 🙏
g
As far as your API tab, toward the bottom should be your functions...
d
found it thanks