REST Nodes - Empty body and status != 200

Dear Knimers,

We have an in house REST API to create users for an in house application.
This REST API may return a status different of 200 (i.e. 422) when the user already exists in the database.

In that case the web service returns also a body which contains the error message. If we use Postman, we are able to get this message but if we use the POST KNIME node the body is empty.

So we changed the status from 422 to 200 and the KNIME node was able to get the message as well.

I would like to know if the REST nodes are able to retrieve the body if the status is different of 200 ?

Best regards,
Joel

1 Like

Hi Joel,
From the code it seems like that should be supported. There are some error body handlers for JSON values. Is the Content-Type header set correctly even when the status code is not 200?
Kind regards,
Alexander

1 Like

Hi @joel,

maybe Extract Missing Value Cause node could get the message out from body column in case of 422?

Br,
Ivan

1 Like

Hi @AlexanderFillbrunn

When the status is 422, the value of the “Content-Type” is the one expected (please see image below)

empty_body

Regards,
Joel

Hi @ipazin

I tried to add the node, you mentioned, and I got the expected JSON error message.

Could you please give me some details about this behavior?
I mean, is it the normal process to add this node in case of the body returned is empty ?

Regards,
Joel

Hi @joel,

Seems certain error messages are not converted and then you can use this node to extract it (if you hoover over missing value you’ll see error message) so would say this is normal process for the time being. But probably there is room for improvement in REST node around this area. Let’s wait a bit and see.

Br,
Ivan

Hi @ipazin,

You are right.
I didn’t noticed but I got the expected JSON error message if I let the mouse over the missing cell.

Thanks for the help and the explanations.

Regards,
Joel

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.