I’m working with RESTAPICLIENT to post to a database. In the process, I’ve built in an action to capture application errors and show the response status code from RESTAPICLIENT in the form. However, the response status code is only populated when the status is 201 (success). Anyone have any ideas?
This behavior makes sense since the REST API will only return a value when the connection and execution was successful.
If the API crashes, the error will be posted in the RESTAPICLIENT system action itself (In the actions history) and not in the action that captures the errors.
That is unless you capture the error in the API itself and return the error in a string format to WorkflowGen.
Here is an example of where you can locate the error (in RESTAPICLIENT action):
If I understand what you are saying, the APP_RESPONSE_STATUS is only populated if the output status code is successful (200-204)? I’m surprised to hear this.
I was under the impression, from the documentation, that I can return the response status code using string APP_RESPONSE_STATUS. I have it mapped to a OUT string variable in the application that updates a field in the form, which is shown in a EFORMASPX action following the RESTAPICLIENT action . But, the returned code it is always blank on the form whenever an error occurs.
We have checked the RESTAPICLIENT logs and it does report a 400 status code and the server indicates the connection timed out.
Is it something I am doing wrong, or does it really not report status codes other than successful?
Hi Smith, have you tried using Postman to hit the same REST webservice with the same payload to see if you actually get a response code?
Here is an example. The correct URL for REST webservice is http://dummy.restapiexample.com/api/v1/employee/156696 which will return 200 status code
If I temper the URL to :
http://dummy.restapiexample.com/api/v1/employee/156696X, in Postman it will still return code 200 but the response content will contain the error message from the webservice
In WFG, RESTAPIClENT will not receive the REST response code but instead it contains the execution error
And you get the execution exception error from the action history