Outbound REST Error

Robert Beeman
Kilo Sage

I'm trying to set up a scripted REST integration (we're on Fuji) with an internal application through our mid server. I'm trying to set up error handling, but I'm not able to figure out how to read the response. This is a screen shot from Advanced Rest Client Chrome app. This shows me the status code, error message, but it also returns the response with a JSON object that has important information. I can't seem to retrieve it from the RESTResponseV2 object.

find_real_file.png

This is what I get in my response from ServiceNow:

error: string = Method failed: (/common/internal/crm/provisioning/employees/create) with code: 400

response: null = null

status: number = 400

If it returns a 200 then that response does show the same response that is in the Chrome app (isntead of null = null).

Any ideas? TIA!

1 ACCEPTED SOLUTION

Hi Robert,



Could this be relevant?


ServiceNow KB: PRB664609: RESTResponseV2.getErrorMessage() does not return message from the outbound...



It does seem to explain why the info about the failure is available in the Chrome Rest Client but not via getErrorMessage().



Best Regards



Tony


View solution in original post

7 REPLIES 7

Hi Tony,



This does sound relevant. I have been working with support on this as well. I'll update my HI ticket with this PRB and see if they think it's the same thing. Thanks!


Hi Tony,



The HI Support Engineer that I'm working with agrees that this problem describes the symptom that I'm experiencing. We are now working with the problem manager. Thank you very much for finding this for me.



On a side note, I tested this is as a REST Message record instead of scripting it, and it does the same thing:


find_real_file.png



The response here should have been this instead:


{


"Message": "User [String7] does not exist in Pivotal System."


}


Vikas-Malhotra
Mega Guru

Hi Robert,



The status code 400 depicts that there is something wrong with the request you are making.


"The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."



Can you please share the syntax of your request i.e. how are you making the request to the webservice?



Thanks and Regards,


Vikas Malhotra