how can I get the response from an Api Rest with error 400,500,404 etc in my stream?

normally I can get the response from my REST API as long as the response code of the request is 200. I have scenarios where depending on the error code I can get a different response for example:

error 400:






            "problem": "email is not unique"






error 500



 "message": "data is incorrect"



in this current flow:

if I get an error code in the request other than 200, I can't catch the error. How can I get the response from the Api Rest request to show the user the message based on the possible data outputs.

my idea is something like this:

I am very new to this, so please I would ask you the big favor to explain me as understandable as possible for example from where I can get a certain element or something like that. Thank you very much

Hi Yeison.

You may implement your logic on the callback OnAfterResponse depending on the status code.

Take a look at this article

more or less at the final.

Also from Rui Barbosa, you have a how to forge component for you to take a look:

Hope it can help you :-).


I hope your doing well!

Please refer below link ,

Kind Regards,

Rasika modi.

Yes its helpful.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.