- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2015 08:23 PM
Hey guys,
I'm developing an application which interacts a lot with REST. In some case, the error will be occurred such as Authorization header is error and I want to get the response body for debugging. With previous version of RESTResponse, I can do log the response body but in V2, the body always is null if haveError() is true. Is there any work around for this?
Cheers,
Duc
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2015 08:59 PM
Seems like SNC changed in getBody() method of RESTResponseV2. Now I can get the body even haveError() is true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2015 02:58 AM
Hi Duc,
Thanks for that. I see now that this is the relevant wiki article:
RESTMessageV2 API - ServiceNow Wiki
I understand your question now:
".. the body always is null if haveError() is true. Is there any work around for this?"
However I do not have an answer for your inquiry.
Perhaps someone else could help out?
Best Regards
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2015 08:59 PM
Seems like SNC changed in getBody() method of RESTResponseV2. Now I can get the body even haveError() is true
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2016 06:10 AM
The problem still exists in case executeAsync() is using. In case HTTP status code is not 200 the getBody() always returns null. As result it's not possible to get custom error details from the body.
Tested on Fuji Patch 10 & Geneva Patch 5.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 05:50 AM
Ducdhm, are you doing anything different to getBody() when haveError() is true? I still get a null response when my status code != 200.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 03:03 PM
I'm with Eric, if the status code != 200, calling getBody() always returns null for me.
