Outbound REST Call
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2022 11:31 AM
Hi there,
I'm new to the SNOW API and I am trying to figure out how to implement an outbound REST call. Here is a breakdown of what I am trying to accomplish:
- Upon submitting a specific request item type, two separate API calls to two different API endpoints should be triggered.
- The API calls will query the endpoint systems using the "hostname" value from the RITM
- The results of both API calls are posted in a comment on the RITM
I already have my API calls down and I can successfully extract the hostname using the API Explorer, so I'm just trying to figure out how I can make a variable in the API call which will be whatever the "hostname" value is for each RITM submitted, and then how to print some message in a comment to post to the RITM record. I've been playing around w/ this in System Web Services > Outbound > REST Message, but there's not a whole lot of options there--is there somewhere else I should be doing this config/testing?
Thanks in advance!
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2022 11:46 AM
Hi there!
You can write a AFTER Insert Business Rule on RITM table, copying the syntax from the Method from which you are generating/ testing connection.
Could you share screenshots of what all you have done so far so that further guidance can be provided.
Regards,
Palak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2022 02:26 PM
Hi Palak,
Thanks for your response! So here is what I have done so far:
Created a new REST message:
Then created this GET Method:
And that's where I'm stuck. What I want to be able to do now is basically be able to add a query parameter (?filter=) at the end of the endpoint URL, and I also want to be able to have a field/variable from the RITM record be substituted in for one of the parameter arguments, like so:
https://..../v1/data?filter=[{"field":"hostname","arg":["<SNOW VARIABLE>"],"operator":"contains"}]
Now I'm seeing the Variable Substitutions section in the HTTP Method record page, so that's sounding more like what I am trying to do. The AFTER Insert Business Rule that you suggested is new to me--would you please explain how I should leverage that to accomplish my goal?
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2022 02:30 PM