Can I call an API from form on ServiceNow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 11:31 PM
Hello, I'm new to ServiceNow. I'm working on integrations and requirement is can we make a call a third party API from ServiceNow via form(UI, by clicking on button, should call API and get response/render on UI). Can we do this? any reference or videos are helpful.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 11:56 PM
Yes, it is possible to call REST Message from a UI Action.
Using client side UI action -> Check the client check-box on UI Action and use GlideAjax for rest API call. get the response from Rest service and return it back to UI action. After getting response In Client UI action You can set the value by use g_form.setValue() function.
Using Server Side UI Action -> Uncheck the client check-box on UI Action, call the REST API from the script directly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 11:59 PM
The usual way is to write a Script Include that uses RESTMessageV2 to make the REST call and then have UI Action call the Script Include.
https://developer.servicenow.com/dev.do#!/reference/api/rome/server/c_RESTMessageV2API
Sample code in following thread:
Script Include calling REST API
UI Action calling Script Include

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2022 04:50 AM
Hi. If some answers have helped you, mark them Helpful and/or Correct in order to close the case. Thanks!
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 11:17 AM
Hi. If your issue is resolved and my response has helped, plese consider marking Correct and Helpful. Thanks!
Martin Ivanov
2022 Community Rising Star
Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Martin Ivanov
ServiceNow MVP 2023, 2024