HTTP requests to projectUrl/rest/v1/resource query #27562
Unanswered
jamesdiffeycoding
asked this question in
Questions
Replies: 1 comment
|
Seems a rough way to go to use direct http requests on the REST API. But if you are going that way.... You will need to meet both select and delete RLS to do a delete. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have been working to create an API server that the front end of my application fetches from, which then interacts with Supabase. The reason I did this is to avoid exposing the apiKey on a server component.
I can successfully POST new functions using the post route below. However, when I send a DELETE request it does not work. The main different I expect would be to do with the id that needs to be part of the DELETE request.
In order to get the POST working, I needed, of course, to create a policy allowing the anon user (the apiKey is the ANON key) to post data. I have made exactly the same policy to allow DELETING data, but I can't get it to work. The function runs, but always returns an error.
If I append an exampleId such as "5" to the end of the delete url, I get a 404 error. If I remove it I get a 400 error.
I'm struggling as I can't find any examples in the docs of how to work for this. I feel I'm shooting in the dark guessing how to pass the id of the note-item that I want to delete.
Code below:
All reactions