Apigee javacallout - ExecutionResult usage and HTTPResponseCode setting

phanim
Participant II

Can you provide suggestion on the below issue?

Q) When aborting a flow with an error ExecutionResult we can set ErrorResponseHeaders and an ErrorResponse but cannot set the HTTP Response Code. Instead always an Error 500 Server Internal Error is returned - which makes no sense. What is the rational behind this?

1 1 196
1 REPLY 1

Instead always an Error 500 Server Internal Error is returned - which makes no sense.

I agree with your point. The interface is not ideal. There should be a more graceful and direct way for a Java callout to set an error response.

The workaround is to set a well-known variable like "callout-status" or something like that, and then use a Condition and an AssignMessage policy to set response.status.code.

Please advise if this is suitable as a workaround for you.