I have an integration which returns the document in binary format and I can convert that to Appian document using the option to Convert Binary response to Appian document.
But this API returns JSON body as below while returning error. I want to extract this error details and present it to the users but the integration object is returning null response body when I select the option "Convert Binary response to Appian document" even though API is returning below body.
Is there any way to extract this body when API returns error and convert the binary to Appian document in case of successful response ?
API Response as JSON body:
{"type":"about:blank","title":"Bad Request","status":400,"detail":"Failed to read request","instance":"/api/v1/"}
Integration Response:
Discussion posts and replies are publicly visible
No, that config cannot be changed based on the return value. But I assume that the API also returns a status code. Then, based on the status code, you could read the JSON from that file and process it.
Thanks for the response but Appian is not converting that JSON response as document and instead returning null value in body, so I am unable to process it.
Sorry, I understand ...
I do not have any ready made solution, but did you try to customise error handling? It might be possible to get access to the JSON inside the error handling expression.
Yes, I tried that but it is also giving me document and not the JSON to parse
OK. I am out of ideas.
But that JSON does not seem to very expressive. Why not just return a simple integration error.
Error posted is just the sample one but there are some specific scenarios in which error returned has specific details which can be resolved by user in Appian UI and this action can be retried afterwards.
Thanks for suggestions!
You could use two integrations. The first tries to send the document. In case that does not work, you could call the other which is meant to process the JSON instead of saving the binary file.
Sounds awkward, but depending on how frequently you plan to face this situations, it might be an option.