Does RESTMessageV2's setRequestBody() work for DELETE method?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 10:00 AM
I was able to successfully access DocuSign's REST API from Chrome Web Apps (Postman and Advanced Rest Client) without issue. I am now trying to migrate that to ServiceNow for an integration. From SN, I'm able to access their login_information endpoint with a GET method, the same as I can with the Chrome apps.
I run into a problem when I try access their users endpoint using the DELETE method (DocuSign). It requires that you pass the user to be deleted as the payload in the body content. I'm trying to use .setRequestBody() with the same stringified JSON that I'm using in the Chrome web apps, but I get this error:
When I was reading the wiki (http://wiki.servicenow.com/index.php?title=RESTMessageV2_API#setRequestBody.28String_body.29 ), it specifically mentions that it works for PUT and POST. Does that mean that it does not work for DELETE? I've also noticed that the content variable is hidden via UI Policy on Outbound REST Message records for GET and DELETE methods.
If this is the case, are there any workarounds/alternatives?
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2016 10:09 AM
I did turn on turn on the glide.rest.outbound.debug system property, and it appears that the same test content that I'm using in the Chrome apps is printed in the logs. I'm just not sure if it is actually being sent to the endpoint.
P.S. I have a like button, a helpful button, and a Correct Answer button, and I'm not afraid to use them!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 09:29 AM
I'm running across this same issue. Were you ever able to find an answer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2019 10:19 AM
Hello,
Unfortunately, it does not appear that ServiceNow will pass a request body with the DELETE method. It does allow you to pass HTTP Query Parameters, though. So if the API that you are trying to consume can accept those as an alternative, then you can use that instead. For my case, I ended up using Orchestration to send the REST message through PowerShell from a MID server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2020 09:44 AM
+1
Deletes do NOT work with sn_ws.RESTMessageV2()
I cannot believe the SN developers conscientiously sat down and said "hey, let's allow a JSON body for PUTs and POSTs but no way will we allow it on DELETE"
Unreal