Dear KNIMErs,
I am currently running a test connecting my local KNIME Analytics Platform to an internal API service. It’s basically a reference check if a certain element exists or not.
Now my problem is this:
When the element exists, I get back a status 200 plus details.
But when the element doesn’t exist, the API provides a status 400 and error details. I need to extract those details, but - looking at the KNIME Post Request node - I cannot see any options to receive error details.
All I can see the “standard” error cause, which for an error 400 would simply give me “bad request”. The problem is that this is not specific enough. Because I cannot say, if this is really because of a bad request (maybe I forgot some forward slashes in the POST Request node configuration) OR because the reference check failed.
The error details are structured like this.
For e. g. missing a mandatory element in my POST request (a REAL bad request):
{
"errors": [
{
"detail": "\"\" is not a valid choice.",
"status": "400",
"source": {
"pointer": "/data/attributes/referenceType"
},
"code": "invalid_choice"
}
]
}
versus a failed reference check (the element does not exist):
{
"errors": [
{
"detail": "line-item-id (12345) DOES NOT EXIST IN ABC-TABLE",
"status": "400",
"source": {
"pointer": "/data/attributes/1"
},
"code": "sys_error_103"
}
]
}
The latter, I could extract and turn into a table and then act accordingly, whereas in the first I know, I have misconfigured my node.
Any suggestions on how to get the error details from the response outputted in KNIME?
Thank you in advance!