- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2016 03:23 PM
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.
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!
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2016 02:24 PM
Hi Robert,
Could this be relevant?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2016 06:47 AM
Hi Robert,
Code 400 can be for example if you provide wrong headers:
Regards,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2016 01:39 PM
Can you try to see if this API works in case of error to get response body
RESTResponseV2 - getErrorMessage()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2016 11:26 PM
Hi Venkata,
Yes, the getErrorMessage() method is what is returning "Method failed: (/common/internal/crm/provisioning/employees/create) with code: 400 ", which is not useful. I want what should be in getBody(), but that is returning null = null.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-28-2016 02:24 PM
Hi Robert,
Could this be relevant?
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