I have created a workflow that uses the REST API plugin to POST to a table in Supabase called patients.
My ID column in the patients table is auto generated int8.
I cannot seem to access the ID of the record that was just created with the POST.
I attempted to change the value of variable with an additional step in the workflow by looking at the results from the previous step, but that doesn’t seem to work.
I tried every a variable with every data type, but no luck.
Then I looked in the log (bug icon), and figured successfull responses to the POST request did not actually include the newly created record’s ID.
So now I am unsure if I need to include additional info in the POST step of the workflow to request that the response include the new record’s ID,
OR
if the ID is actually available, but I am not taking the correct steps to access it.
This is really stressing me out lol
Any help would be greatly appreciated!
I am able to drill down into the error object if the POST receives an error, so it kinda made me believe I am doing something wrong/Supabase is not returning much for some reason on success.
p.s. The reason I would like the ID of the new patient rec created, is so that the user who added the patient can take additional steps in the same form to attach more information to that patient in the database.
Hello, you can check out the network tab in ordee to see the whole error. Also, why are you using REST instead of the WeWeb plugin? Is there something missing?
Hi Broberto,
I am using REST instead of the plugin because I believe it is part of the requirements for HIPAA compliance. It sure would be easier with the plugin though.
I have looked at the entire error message, I actually don’t have any trouble accessing dif parts of the error message, ironically it is when there is successful POST response where I am unable to see any details or find the record ID.
Hey Actually, the WeWeb Plugin uses Supabase’s SDK, so I wouldnt be concerned about the HIPAA that much, or is there something in particular? I highly suggest using it, it simplifies a lot of things. If you still need help with REST tho, posting your setup would be beneficial.
Okay thanks for the info. I actually originally had it setup using the plugin, and everything worked perfectly, was super easy to manage as well.
But then I read this (from WeWeb FAQ) when looking into getting a BAA signed for HIPAA:
Can I satisfy HIPAA Compliance while using WeWeb as my frontend?
Yes. If you use a HIPAA-compliant backend and call it through our REST API plugin, in dynamic mode, your data will not transit through our product, making the whole project HIPAA compliant.
I see now, but I think that WeWeb doesn’t handle any data with their Supabase extension, other than storing the secrets (your apikeys to the Supabase instance) and maybe protecting routes (this can be worked around). I’d probably ask @Alexis for the tech side and @Slavo for the compliancy, as I can’t tell what WeWeb exactly does on the background. I think though, it should be possible to use the SDK and be compliant. Anyway, it would be great for someone from the team to confirm.
Hi @Alexis and @Salvo, do you all know if it is necessary to use the REST API (instead of the Supabase Plugin) in order to have HIPAA compliance?
If so, do you know how I can get a POST request to return the row ID of the record that was just created?
Thanks!
I actually am not having any trouble getting a successful POST with the REST API. I just included the error (intentionally created) to show that when getting an error response, I am able to drill down into the different pieces of data in the error message using the WeWeb GUI via the “lightning bolt” for previous actions in the workflow. But with a successful POST response, I can’t seem to get anything via the “lightning bolt” for previous actions in the workflow; it just shows the blue icon “result” as a Text Type with what seems like no embedded data, and has a value of “”.
But either way, here is all of the screenshots of a successful POST workflow, step by step. I obscured the apikey even though I believe it is a public key that is available to the browser, apologies if that is super silly.
No response body will be returned by default but you can use Return Representation to get the affected resource.
On the other end of the spectrum you can get the full created object back in the response to your request by including the header Prefer: return=representation.
I really really appreciate this, thanks @dorilama !
I was looking in all the wrong places, it’s hard when you don’t know what you don’t know! Response Schema | Axios Docs had me pretty confused too, and now I know was googling too much with Supabase search term, should google for Postgres instead next time. Thanks again.
HI @robot_computer, no it is not. You should use the plugin. Calls from your frontend are made directly to to the backend. Data does not pass through WeWeb infra at all. We only store the keys through the plugin so you can comfortably work with the instance.