Custom response API workflow

Hi everyone.

I’m creating a API Endpoint with backend workflows but I need to do some validations and return which was expected. For example: I’ve built an endpoint that creates new things in my database, however it needs to be validated if this new created thing have a field equals to another already created. Basically if it was a user, would need to validated if there was another user created with that e-mail, and return a custom http code (409 for example) and a message from the server “that e-mail already exists”. I tried to accomplish that by using custom events, but they seem to not work inside my API workflow and I can’t set custom http codes in my return, so even if I “throw an error”, it will still return 200 to my user.

Can someone please help me with this?

2 Likes

Any update on this ?

+1 on an update on this too

I am also in need of returning a custom HTTP response

I found something interesting. It seems that you can indeed control what response is sent after the execution of a workflow in the Bubble API. Check this out

https://manual.bubble.io/core-resources/api/the-bubble-api/the-workflow-api#return-data-from-api

I haven’t thoroughly investigated this path, but it seems you can define the content of the response at least (modifying the response code, i.e. the HTTP headers, might not be possible)