How to use REST API in Business Rule?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 03:19 AM
Hello,
i have created a Scripted REST API, it’s a POST Method to create Changes and when I open it with the REST API Explorer I can submit values und send request.
Now my question: Is it possible to give values with my Business Rule to the Rest API?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 03:45 AM
Hi,
your question is not clear.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 04:29 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 03:48 AM
Hi,
You can check this code
var req = new sn_ws.RESTMessageV2();
req.setEndpoint("give your end point");
req.setHttpMethod("POST"); //give your required method
req.setBasicAuth("rest_user","123"); //give username and password if basic auth
req.setRequestHeader("Content-Type","application/json");
req.setRequestBody(JSON.stringify(body));
var response = req.execute();
gs.log(response);
Mark as correct and helpful if it solved your query.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2022 05:07 PM
Hi IG,
To answer the question, yes, it is possible to call REST API from business rule.
There shouldn't be any problem. If it's not working, would need to see the code.