How could we change a HTTP status code response from an API 401 to a 500 or 503

Hello, how could we change a HTTP status code response from an API 401 to a 500 or 503? We have this Inner Tree that calls to this API to get User info when this user it’s not cretaed in IDM to create a user with all his information (It’s in the API). But when we test this Tree to fail by the API (on purpose) it gets back a HTTP error 401 instead of 500. We wanna change this error, since it is a server error and not the user’s, we thought with a scripted decision node would work.

We working with AM 7.1.1

A.F.A.I.K. As of today a tree does not return 50x error codes. You can customise the error message using either the NodeState, or Action APIs but not the error code.
https://backstage.forgerock.com/docs/am/7.2/authentication-guide/scripting-api-node.html
If you absolutely need to change the error code it has to be done outside of AM, e.g. through a Gateway.

1 Like

Hello Gery, thank you for the answer. This help us to how to procedure, in this case we gonna customise the error message.

1 Like