5. Ad hoc REST actions
so we've seen how to use integration of spoke to take an action by making a rest call to another system now we're actually going to show how to create an action that makes a rest call to an application that hasn't been pre-configured so let's go to demo action for rest request i'm going to change this out of the jira's book and put it in global i can go ahead and categorize this one just like you saw earlier let's go ahead and copy down this name to the description and we'll get started now just like our subflow that we configured we do need to configure some inputs and all that's going to work the same so we can go ahead and use this button to create inputs what i'm really interested in showing is how we can add different steps like you saw that were pre-configured now first we can do stuff within servicenow create tasks look up records create records all that stuff we have some utilities we can run scripts you saw that in the pre-built one we can send notifications send emails we can build our payload in json or xml in order to be utilized in a rest call here's the integration pieces so i've got sftp i've got rest down here i've got soap i can use ssh i can use json parsing and xml parsing lots of options there i'm going to show you rest because i want you to see how this might actually work we do want to configure connections or authentication whether it's basic auth oauth or whatever we want to define that elsewhere so i'm going to skip over that for now creating connections not a big deal you create it once reuse it in any kind of action or subflows that are flows that you want to but down here we can build our rest request manually so we can say hey this is the path for the rest endpoint that we're talking to the other application here's the request type we're going to do whether that's get post put patch or delete and then here's my parameters i can add as many of those as i want or i can add as many headers as i want you saw i can delete them as well when i click delete this is how you'd manually build it so maybe you've got a custom rest endpoint that you're trying to talk to so you can do that and get it built and test it i'm actually going to show you how you can automate that so we can use an open api specification and import that open api so if i wanted to for example pull in the salesforce open api i've got one for iot connect so i just copy in the url if it was protected i could provide a username and password and hit import and it's going to go ahead and bring in that particular api structure so that i don't have to recreate all those query parameters and headers so i've actually already have it loaded there's salesforce connect and notice now i've got this option of which operation do you want to do within the api so i can click the down arrow and i'll just scroll for a second and you can see all that got pre-loaded and if i pick on let's just do get activities it's going to go ahead and populate the query parameters and the headers that were built into that open api so i don't have to go do all this myself that's how easy it is to configure a rest call to a third party or other application and once i define this action i save it i publish it and i use it just like we've shown in the sub flows and the flows to be reused repeatedly and take that action several times over and over and over again
https://www.youtube.com/watch?v=q5EPDjr70JQ