2x7 API Integrations
welcome to service sharp this is a podcast all about service now we'll be talking strategy architecture technology and everything service now this podcast is not affiliated with ServiceNow the opinions expressed are our own we're just people that are very passionate about the platform join us for every episode [Music] alright this is Jason Gibson back with Sarah sharp and of course I've got Randy Brent and Justin with me we're gonna do something a little bit different this time we're going to be doing something a little more technical and we're going to be doing screen shares this is going to be posted on YouTube so this is more educational than we typically do you'll actually be able to learn something and unless except for us rambling on when we do but Justin Brant Randy which you guys said say hi real quick and we'll get started hi my name is Justin class well I've been working with service now for five years I believe we're coming up on five now 2015 that'd be five years Wow only two I guess so that's how math works I think it is this sometimes for some reason it feels like I've been doing this all my life well it's only been five years but it's been you know like 12 versions yeah I mean we were on we were on e and you know now so I don't want to do the math there because that would make me look smart and I'm not anyway we don't want anybody to see me struggling with doing that math so I'm gonna do yeah you don't want to see the pause there for camera so you can't see me captain with my fingers we're gonna actually API and integrations and justin's kind of gonna walk through that real quick and kind of show you an example of what that would be Justin why don't you take it from here and let me know later I so I can harrass you know sounds good so I'm gonna go over today is the is a very simple REST API it's not going to require any authentication but I'll show you where you would enter that on the screen now you can see the wonderful service Sharpe available on anchor fm and then we also have it on youtubes without this yes which is probably the best place to watch it at yes yeah I don't believe the podcast would be the best place to do that so go over to our YouTube I assume there's a link somewhere from the podcast to be able to get to this that's probably a good idea yes so anyway hopefully that link is down in the or over or up in the description wherever it's located at in a particular platform and I'm gonna move on now so it gets better folks it's a real quick I'm just gonna run through a couple things first is the developer website it's amazing website developer deserves now comm sign up for a free account you can create your own instance here it's not flaking it's currently woken anyway you get a free instance it's very good especially when like a new release comes out you can upgrade it to or just close it out and make a new one for whatever the newest release is or you can keep them open for a little while I don't know how old you can actually keep they forced it eventually to move up but anyway you get these free ones you can play around follow along on what we're gonna do it's very anyway kit you can always restart it yeah if you ever mess up you've got all sorts of you can play with plugins you can add demo day to remove demo data reset and wipe there's the upgrade although there's nothing to upgrade it to so I don't anyway yeah great website and they also have these little learning plans you can take every every release they update them so it'll look like you've never done anything so if I went into one of these they'd be empty but depending on where you're starting at these have some excellent in excellent courses that you can take little modules that go through all sorts of stuff these are getting more more advanced as you go down here but this first one is definitely great even if you're you know not necessarily a everyday worker but you're interested in it or just thinking about anything like that these these basics one really goes over some of the core concepts no sorry highly recommend you do it that's on the learning part of the developer site and then your instance itself is also available there if you want one so moving along here's the my developer instance that I started for this will be working out of it very very generic the only thing I've done is a have created the rest message to make sure it works but we're going to go through all that again and do it anyway and this is the example API I'm using I have no idea who who made this but they it's a free one you can make or that you can consume rather sorry so thanks to this person props to them but anyway it's a wonderful API it just has very basic git I'm not going to show it a new post put or delete but again if you wanted to play with it they've given you the endpoints here and details gives a little bit more information about it and also shows you the sample results so again great great little website that's what we're gonna use for this we're gonna do this first one here that just grabs a big list of all employee data which is actually I don't member I think it's like nineteen records or something like that no people this is all live so people can mess with it there may be more or less than you did but we're going to do a basic rest integration so things that wrists are commonly used for you know whether api's like on here they said the finance API if you want to check stocks or whatever else you might be needing to show I know weather is common mapping data is also a common thing you would use a rest call for I've used it for zip codes you know somebody put it in a zip code and you return back the city and state that that zip code is in you can also do the river you know address looks up it lookups all sorts of things if anyone else on the call those any other REST API they've consumed dona on the spot here okay moving on I couldn't think of anything else ahead yeah I can't really think maybe about whether and whether we did the Maps API was one that we've consumed you know and I use for testing stuff I use a different you know I use postman but they've also got like if you have a service you can actually do any sort of SMS outbound thing that you know like they're doing push messages here with the service now app service now the service now integration has been is pretty pretty simple with the rest messages and and they have another knows but yeah it's like is one of those that you can so anyway to real quick well as you see here I've made this one already but we'll make a new one so to get let me start over here and when you're on the main thing just type rest up here in the Navigator and you will see outbound and rest message is what you want to is you want to click on it and then new would be to create a new one and for this we're just gonna do example rest please and the end point is not admin that is just for some reason following my wonderful Auto populated stuff there but the end point but for here is what they're calling the full route so you would take this copy it and then paste it in there if you wanted to make this multi-purpose because all of these api's go off API /b one that might be a better a better way to do it would be to do this and then you get multiple calls that do each of those but and that particular one has to be v1 which is version the v1 encased version v1 v2 if you leave it blank though you'll get whatever the most current version is so I think that's something that we we like to do occasionally now when you're when you're talking to a service now you definitely that's the optional some api's that may not be optional I have not tried this particular one to see if you can leave out the versions but ServiceNow definitely does it that way they do that so that if you do use let's say version one if I we ever change it you still have version one and so your integration with us does not break type of thing so that's pretty common like Jason said for you to be able to leave that out but on this one we're gonna leave this way and we're having no authentication this again would be if you have basic or OAuth you can if you choose basic which is basically it's like users bank password and you just pass it and then you can create your own or use the built-in one this is easiest where I think to make the authentications is to choose it and then click the search there and then click new from this page instead of trying to find it over here in the navigator there's several different types of authentication the things you can make credentials you can make and sometimes it's not it doesn't create the right type but if you do it through here by choosing base it already has all that assigned so anyway if you're doing it one that does require authentication of some sort you would make it here mutual authentication I've never used that but okay so it can only be mutual authentication can only only be used to the mid server as well so in it it can work it's basically like sending it back you have tunicate than it if indicates any way that'd be something to play with if you need it but I've only ever IDs basic and oh if I had to use for a Microsoft in Tunes integration once but moving on here's where you put your headers this particular API does not actually require any headers to be passed but some will require you to pass you know like form and then Jason Jason is how they'd want it labeled and so this is where you would put your header again this would be on whatever API documentation you have so if it's like a Google API they will tell you what request headers you need and this is where you would fill those out we don't need any for this so I'm just going to leave that blank and then and these are just strings they're not you know there's no if you put a number it's still just a string just throwing that out there and then I like to save it instead of submit because that way I stay on the page it's all right click up there and save and as you can see we now have methods you have a default get which is automatically gonna pull whatever you had is the endpoint so we'll click on that and as you can see it's already got that filled in we again you're allowed to inherit if for example on this one there was the there's post and put and delete those are possibly going to use different accounts so you may have to again specify a different authentication type here where your interests inherit here again is your option to add the request headers and query parameters query parameters are like up here in the address bar anything after this little question mark you know URI is a is one of them and then this rest message would be this right here would be any value so just to give you an idea what a create query parameter is there just a little welder query parameters in order to know has to where'd that anyway anything after the question mark and before an equals sign and then after this it's going to be an ampersand wherever the next one would be in there that I can't find so okay and then and the neat thing about these so here I'll show you up here you can actually do variables in your endpoints or your headers and query parameters and to do those you just do you just do that which would be a dollar sign curly bracket and then whatever you want their variable to be named and then in curly bracket and so I'll show you how to use that here a second but again you can use them in here as well so if we do filter and we'll do dollar curly filter and then we're going to go ahead and save this again and I'm not sure you can auto generate variables up here or you can choose this one here or you can manually create them so I'll create the first one manually real quick we're gonna create filter so you hit new we don't want to update our password the name will be shelter the test value it's gonna be Jason's we do not want any escaping unless you're doing if you're sending XML you may have to escape but don't worry about that usually inside you can see it automatically adds it down here what that's gonna do is just replace this here with over Jason and I'll show you that again since we added another another variable up here we can now still hit generate and it should generate yep and now we have type and so for type if we look back on our API I hope I'm not moving around too much here after v1 was just employees so we'll go back here and for a test value of type you double click on the you can type it right we have employees these are just the test values that you're putting in here they're not necessarily defaults you'll see how to add to those but again we have the two types and so this is gonna make that be v1 slash employees so at this point you can actually just test which is what we'll do here in just a moment actually let's go through with the test real quick and before we start messing with the background script and how you actually would consume this in code I'll take a break for that after I show you the test but again now that the variables are down here and filled in or if you don't have any because you're not required to have variables so if you had no variables on here all you can just hit tests and it will bring bring back the trend update the password again status 200 200 means a success generally technically the person who makes the API can return wherever they feel like it so again reference the API documentation but most commonly 200 means it's a success and they've like a 401 and a 403 I believe or generally account issues whether it be permission or password 500 and 400 are usually either you have a malformed syntax on sending it or the server-side something messed up 500 is generally something on the server side but it can still be you messing up the query as well so just some things to keep in mind 200 good any of the four hundreds are generally your fault or the pet you know where the account may not have the permissions as well that's usually a four or three and then 500 is also can be anyone's fault but definitely not not good and those are just again the the common numbers but they can number it however they want technically if they don't want to follow defaults so again here's what the in point ended up being as you saw we had it typed where it had the type you know dollar sign curly type and instead it put in the test value there is no parameter actually because you don't you don't pass them it did not have to pass them here that here's the response you get back which is all of the employee data in one big JSON string this can be returned back and anything could be XML it could whatever the API is gonna respond it does not have to be Jason but JSON is really in my opinion easier to work with it is very simple to work with and I'll show you just how simple here in just a moment so again that was a test you can go back to your test run and I'm gonna delete the header here because we don't actually want the header actually you know what let's let's make one put the filter down here and then I could show you what it would look like if you have a query parameter in your let me save it real quick and I'll show you what a query query parameter will look like on a test run I'm an auto generate again which will delete everything there and oh I make that dollar sign filter are you making an actual variable okay save again Auto generate it okay we now have the filter and this in the test value is where we put Jason and now we hit test and right here you can see that if this is what it would add as a query parameter the filter and then it replaced with Jason which was my variable replacement so I'll show you how you can do all that by code later because a lot of this especially if you're like trying to consume this one here where you push the ID of the person you'll probably want to do that from a script somewhere so I'll show you how to replace the query parameters by a code here after we take a quick moment for Jason to to talk to you about something all right so yeah we need to take a quick break and listen to our sponsor and and when we come back we're gonna be moving on with this and continuing to talk about how we we use this so give us a few minutes and we'll be right back this podcast was made with anchor anchor is the easiest way to create and publish your podcast it's free creation tools with it allow you to record and edit your podcast right from your phone or computer helps you distribute your podcast it's super simple to publish to Spotify Apple podcast Google Play any of the major ones you can make money from your podcast there's no minimum listenership so they make it super easy to monetize it's really everything you need to make a podcast in one place so why don't you go out and download the free anchor app or go to anchor FM and get started all right we're back and and Justin he's in an integration and how to get an integration done kind of a step by step so Justin if you don't mind it's going take it from here sure so real quick I'm gonna run another test just to I want to show you how simple nothing how simple JSON data is to work with here helps if I show you my screen doesn't it all right so if I just pasted in there's the whole the whole JSON response just right-click format this is using visual code but I'm sure all sorts of probably should have hid all that anyway all sorts of this tools can do this I imagine sublime and probably note that post plus or whatever else there is out there but yeah now you see the status the data how each each individual record inside that data very simple to read and much lighter than XML is so again just very easy to work with and assuming you have a tool like Visual Studio code which is free that can do a format document and filter it out like this very very easy to read well a big old clump of XML you can format xml as well but it would still have a lot more special characters that might make it harder for some people to be able to filter through and read well not only is it that the name is pretty awesome too but it isn't it is very easy to work with yeah well there's yeah it's one of those things where you know I call it Jason some people call it JSON I don't think it's not even tied to like how long you been doing it because there's plenty of people who have been coding longer than me that don't use the same way of pronouncing we all know what we're talking about unless there happens to be a Jason in the room like there is on this call then I guess it could be confusing but anyway so that's the very simple part of just querying getting a result back from a REST API now again this is out on the web this is just a website out there so it's not like I'm querying the ServiceNow and since this really did go out to a website consume their API very simple just a handful of clicks especially if you're consuming a public API that has no sort of authentication which I mean even authentication would have taken another you know three fields to fill out on that authentication program so it's not other another five seconds yeah yeah oh and I guess I should I forgot to point this out earlier if you are not doing an external call and you need to do in your own network you would use your mid server and here you I don't think the instance has a know that the test instance doesn't have a mid server but you probably do if you have a install going and if not they're very easy to set up obviously I'm not going to cover that in this course but anyway you could choose a mid server that would scan your local network however you have your mid server set up again make sure that it has access to whatever server or site you're trying to to consume because some networks are far more complicated than others so but again that's how you would do it would be here you just choose it on the HTTP requests I don't believe you can actually do it at the top level yeah you can't do it at the top you have to do it at each method I don't entirely know the reason for that maybe it's just to prevent accidentally using a mid server and I really like to change the default get to just get or something more specific as well and that you can do that as well and we could rename it get and I'll show you how this hold on when you preview so this is how you would call it the name and that's like jason has a good point this name is how you're gonna refer to this method when you're trying to consume it in code so default get might be probably not confusing but it might be confusing to someone who's looking over the code and not familiar with it so if you just if you just change it to get or you could even do you know get employees or whatever whatever you want to call it and then save it and so now whenever I click down here to preview script uses this will actually give you a copy and paste a bowl example of how to use this in a script include I have not tried it client-side so I don't I can't answer that question if it works on client-side I do know it works in a server servers include our script included or a business rule though I do know it works on those and again it already if you have any variables created it will already give you this here if you do not have variables obviously there will be none there but these are handy because like I was telling you earlier if we needed to change on one of the other calls there would be another one that is you know employee comma one or whatever and that one would be in your business rule or script include you would pass you know current user number and then that would query the API that way so that's how you would use it as and I'll show you how to do that in the business business rule here in the second part not a business background script so a we can copy and paste this code and I'm going to do that and then I've used it in script includes and I've used this in in business rules and scheduled jobs but I don't think I don't think I've reached in the client side either is actually suggested not to use on the client side because of because of the way it works all it is suggested to use on the server side since it's your eyes I mean we you can still call it call it for a call a server-side server-side from client side if you want to pass information into the client side that is call your script include I mean that's the way I would do it just take another level of removing that from the user anyway mm-hmm because they if it is available to do in client side they could technically manipulate the the JavaScript of that code if they were smart enough I guess to try to do that again I'm not not so sure how well it would work in a client-side script but service recommends not doing it client sites yeah things are gonna do it behind the scenes anyway because again we're gonna pass like you're gonna hit submit and you're gonna want more even on populate you're gonna want the the code that way so you would not I don't think you want to do too many client things it would also drag it down pretty heavy you could with like I say and just do a glide Ajax which would it works exactly like a like a glide anything like a glide record call you know same-same way of working with it and you can call script include that way but anyway moving along here let's type in background over here on scripts background click it I really get it get that thing to quit prompting and then the code from earlier if you just paste it in here you're actually gonna get nothing if you hit the run because you're not telling it to print so one of the one of the things I would recommend adding would be and I'm going to copy and paste quite a bit of this and I'll go through the lines as I'm doing it first I would get rid of all this anything commented out because you're not let's do this in a suit and editor this will be make more sense cuz you're color coding helps everything so here's that code - this is the new bit we'll be adding but if we get rid of a commented out code it's not actually doing anything and it just makes it harder to read so let's although and again it tells you if you want to override your authentication you could do so here same thing with a mid server you could specify it here and then if you want to do any ccq stuff which is events mostly like it's a thing a way of working with your mid server as well I don't never mess with those but apparently there's a way you can do that in there as well and it describes it so what I would do here's the base code that came with whenever I hit that everything - the commented out code what I'm gonna add here is one of parse using the JSON jason whatever that's built in javascript so we will parse the response body which is here we will then turn that into this this variable which is actually not vietnam and dot data and as you saw a minute ago here's data so that's all this is all an object now so first level is that and these are the next two I can do status or data as we're as we're choosing here data is going into this variable which is still going to be an array of objects and then you have status which status will be success at least hopefully that's what we wanted to say when it returns back and we're not actually going to grab any of these I don't I don't think I do know I'm down just grabbing the length of it of just the employee data which again is the dot data so that'll count all of these that are in the in the data property there so and then we're just gonna pass them out into GS print which is how you get things to show on a background script if you actually want to view them yeah basically it without doing in GS stop print it's not gonna have anything you're not gonna know what happened yeah it's just gonna be it's just gonna return like I had your a moment ago where it's just empty you don't know if it's a success or a failure failure a really bad failure you could look you'll be an error in the script it's what I would show if there was a big problem yeah if you have a typo actually will tell you about a typo so let's leave off something that would actually care we go now it's telling you hey missing the in parentheses it doesn't point you necessarily there it doesn't say line 18 which it's not line 18 because it's line 18 taking the first time that recognizes year is after all that but anyway at least you know and I like to do the background script to try and start to kind of build and test things before I put them in the business rules oh for sure yeah I do everything I have a background script first I even do business rules out of background scripts if they're working with the current variable the current object and whatever because you can mimic it and I guess I can show that another time how I mimic the current record that way I can still do like current dot number current name I still test all that stuff without having to have a current it's like doing it in the business role I can all doing it back in script right yeah right yep but anyway so if I run this you can see the steady let me see if I can squeeze the code here at the bottom so the peers the results which is this one here and I that's gonna be awesome don't click Justin the slash are slash in is why it does a new line that's returned in the new line so status 200 is status and then we passed the variable 200 blah blah blah there's the body which Yeah right here and then of course the response body and then we print it out a little bit nicer way to read it here where it's just the status and then we put the code number itself and this one here HT status is actually a built in this one is going to be defined by default when you do that schedule or a preview script usage it's automatically gonna have that on there but a lot of people a lot of people the the actual number may not be as helpful as string which again should be in the API not every API will be called status though they may have a different different way of doing it but what most of them will return you back what the code actually means in terms of a string so that's what this one is doing that's why it says success no again in length there was 24 records with 24 records which if you really want to you can can actually don't have to count because they're numbered so 24 apparently they don't start with 0 no they don't bad coding there but anyway that's that's it that's very simple if you wanted to consume this again you would bake a business rule that's how I would probably do it or a schedule script included as Jason mentioned earlier a scheduled job you know that's a very common way of doing it I've done it to workday I don't remember if that was soap or rest though but anyway any sort of like this here you might even query every night bring it in and then filter through the results and make sure you know Tigard nixon's employee salary maybe it up did why he gets paid well or she yeah you know maybe their profile image whatever you can just run through each one and check it against what your maybe your user table or if you have a custom table or CMDB table you know whatever your data you're pulling in you could then run through it now that you have the object here again dot data is simply because of the that's the way this API works check your API documentation that you're consuming but for this object employee data we could we could filter through the employee data where we do like for VAR i 0 i is less than infinitely count and then you could filter through and go through every record here we don't every record there and actually work with the data with inside of it inside your scheduled job business rules script include or if you're doing glide ajax again you're gonna do all the heavy lifting in that script include though i as the other guys mentioned i do not recommend doing any client side stuff if you're gonna just pull it that way leave all your actual code like the logic the business logic should be in a script include in my opinion because then if i want to i can consume it in a business rule later or a script include i mean a schedule job later it's you can reuse it much easier whenever you make them in script includes so if you're doing a ton of business logic with something like this i would make it in a a scripting clip so definitely solarwinds using the the scheduled job running the script and the scheduled job to grab the data and and to bring it in and put it into so what you do is you use this and this is where you get all the data then you bring it in and you actually will put it into an import table that you've created for it then from the import table then you can run your transform map yeah i'm i used to want to look up the addresses on the locations and put the longitude and latitude in there so that the maps would be populated automatically but it would just do that off your locations and it was a scheduled job that ran every so often i think we did it once a week because it was a lot of data to update but yeah we did a business world that grabbed the they put in an address at the beginning and the end date of where they're going so they clocked in clocked out basically from their location and put their location down and they in it went out and grabbed the Google Maps API and actually filled out the the distance it's actually the Google distance API but yeah oh yeah I forgot we did that one too and I was I was thinking the locations when we made it made the longitude and latitude show up so you could see them on the map yeah so one other thing I'd forgot to point out in the code here this this line we are calling the rest message v2 the first one is going to be the name of the endpoint so R which in this case is example rest employees are the message lives what they're gonna call it and then this is the method so we called it get underscore employees again to Jason's point earlier just a default get so you kind of want to be somewhat specific so that you can glance at it and same thing what's it's important to name your message as well to make sense so this may actually be fairly bad you may want to call it you know like Active Directory employees or something you know name like that maybe why you would want to name your met or even just Active Directory and then the name of the method would be get employees or something along those lines so it would be descriptive on your messages and your methods so that in the code when you glance at it it's easy to see and again again if you ever want to know if this is somebody gives you the code and you're and you're trying to figure out well how do I see this in the actual platform you just want to look at this first bit here which is example rest again type rest up here in the filter go to outbound rest message and it's gonna be the name that shows up here so for that in this particular case it was the second one I think exact example recent ways and now you now you're in there and you know what it is so that's really all I wanted to to cover this again is just a very very quick basic run through that brings up a point though you want to make sure that you don't duplicate those rest message names because you could I mean it's gonna run into issues when you call them in the script yeah or like I had on like obviously you can't do the exact same but to his point you could name it very very similar right like these aren't as similar as I thought they were but let's say this one is whatever you get the idea if you name them too close together you'll have a harder time finally you can try to find it by the end point but the end point does not have Stannis like see this one here doesn't have the employees part on it I don't even you do have to have one but I think I could put probably anything in there as long as it's a valid yeah valid URL it doesn't actually have to match any of your method which the method as you can see down here is still is still the API so you know that first first page we're on the message itself the end point I don't actually I think it's just used for what you're going to default when you create if I create a new method now no I actually thought it was gonna default it I have no idea what the point of having that on the messages cuz this doesn't seem to ever do anything it writes down to name actually I bet since I'm not required to have you know we're still doing again I'm not required to have anything here way that's gonna fail because there's a good example of a failure that looks like a success because here's 200 but as you can see down here this is regular HTML and that is not somewhere on here it's probably gonna say and I'm not gonna find it we're almost there keep searching it'll say yeah it just loaded their main page yeah it's not a valid end point for the people listening and not watching what did you do to cause it to do this it looks like a success yeah that's good so I left on the the new method that I made I left the end point empty which seems to use what you have on the deep on the message alright so you can leave the endpoint empty on your methods that you create under the message so that's the hierarchy message is the top and then you create methods to that and apparently you can leave them empty and they'll use the MS the messages default and or you can specify your own of course on each method so that was kind of a nice little nice little test there but anyway while I was trying to get out of the whole point there is when you go to rest message itself endpoint may not be a useful thing it may not be exactly what you're looking for so try to try to use the name which is the first parameter of the Essen rest message v2 I think is what it's called so and if you're really good you could own but a real description in there of what the message is being used for yes this you could type something useful here because as you know everyone uses that description field yes exactly yeah even the built-in ServiceNow ones don't have a description that's enough I was being sarcastic because yeah I mean it's not a required field so obviously it's not important even the ones I've gotten from companies don't have the description so yeah but at this level can you yeah see that's kind of they should add a description to the method more so than the message because well what you're supposed to do is what I what you're supposed to do is for the methods are supposed to be get post push delete like you're not supposed to necessarily go to a totally different endpoint for each one because an HTTP method is get or post put and then delete I don't probably more than that but those are the common rest ones and that so that's kind of the idea they did but you can consume if you want to do it by like the integration itself rather than say each message is its own actual service now rest message you can combine them all under one and just be very clever with your method naming for the HTTP and that probably just sounded more confusing than maybe but anyway they let you do however you want you're not required to only have it be called post and have one of them you could have you could have a hundred actually I have no idea what the limit is so don't quote me on a hundred but you can have a lunch I've had I think I've had eight or nine I don't know if I ever even gone over ten on one but I've had several that are you just change the endpoint on the method because I'm trying to use that message kind of as the container for like any example I have on the screen right now firebase cloud messaging I would have what however many different API calls or different api's they offer would all be under that so anyway again you're allowed to do it however you guys feel so you could create a rest message for each one of those that you'd want but you could put them all underneath the same method or and they're the same message they would just be different correct so like on this on the API example that I have on the screen the website we use which all five of these could be under one message or since each one is technically its own endpoint you you because it's not like it's not employees push pull get post whatever it's it's each one is its own so you each one of these could be its own message which technically they are their own message if you want to be completely technical about what arrest message is this would be a get rest message which the method is still technically good even says method right there look at that back me up Thank You website so yeah you could just have it could be a one you could have five separate entries on your outbound rest messages or you could have one that is the you know whatever the name of the application is in this case dummy REST API example and then have five methods under that as a you know kind of a container type thing for all that are related to that I know we're kind of beating this one right but it could work either way however you wanted to manage it and again just to be clear this is like the very quick run-through that probably isn't quick in terms of time but it is quick in terms of what I'm trying to show I'm not trying to go through every line or every possible option option that you can have we can definitely off go much more in-depth if somebody needed that well and yeah and and if you need some additional help or you want to reach out to us and and ask for some more specifics on one thing or another you know we can we can help you on that I will say the thing that we haven't really talked about is how you get it from here into Intuit the table if you would the import table and that's Justin could you kind of made me do a quick explanation of how you get it from from the business rule or or scheduled job into an import table if you're wanting to do it that way probably won't go into huge amount details so one way to do that is to extend the import set row and then to create a transform map on that and I'm just describing this I'm not actually showing anything that's one way to do it but again I doing those are very specific to each integration you're doing you may not want to do that you may just want to have all the code that's happening in like I said earlier Script include to where that's where all the logic is and you're not using a transform app necessarily because maybe you want a little bit more control I mean a transform app is handy but you know there are some things that is not necessarily going to be the best case for so we could go into those again maybe on another another podcast or something if or well and and and I was more specifically thinking you know how do you how do you get it from the script like it you know are you using a glide record you could if that's the way but you could do the transform map like we mentioned on an import set row which would then when you insert into that table what you would do like in that scenario you're probably going to do that most often in a scheduled job if you're gonna be using an import set table you would probably be doing that in a scheduled job and when it runs the scheduled job itself would call you know this bit here call the rest message and then once you've got to once you got to here this is where you would do this is where you do your your your insert with a glide record into whatever that custom table you made that extended import set row and that's where you would insert into it mm-hmm but again that those get really complicated really quick so that's more of a either we spend time and I actually be able to give you an example because coming up with one off stop my head is gonna yeah you're not gonna probably be all that useful to try to explain to somebody again especially at the pace I'm trying to go for these on how quick I'm covering stuff but if that if we get enough people who want that sort of thing you know we can definitely show you how to how do you consume or so consume this instead of this was just how do you get the integration connected and at this point you can query that system you're not doing anything with the data as Jason pointed out you know the data is it's just we have the option to call this and get a response and manipulate it in various whether it be the script include or the scheduled job or whatever we want to do there are many options and they're not all it's not a one-stop shop either for integration sometimes you're going to want to do like a one-off like a business rule call like it may be an async business rule where you know you have a new user record gets added to the sisters ER table you create a business rule that's in going to query your eight your employee system which would you know in the example here it's going to be the one that you're allowed to pass an ID to and then we get that single employees data back and then you update whatever your sis user table is with said data you know that be that's a decent example of a way to use this in a business rule and it is a you know that's a good way to to do that like I've worked with ulti Pro before they don't have a REST API so I guess I should take that back but I mean that is a system that you could a system similar to that where there like a web-based HR portal where your HR folks do the onboarding if you're not using ServiceNow which there are options for that as well call sharp stone I'm sure we're able to help if you'd like that but anyway yeah you could you can consume the data that way on a one to one type of it has and the reason why you look on lining you don't see a lot of stuff about integrations is is because everything is differently you know when you're talking about integrations if you understand how things work similar to this now you know how things get connected but each system that you're gonna connect to is a little different so there isn't any cookie cutter answer right I mean we we have one that is triggered by workflow and it goes out to the VM environment like V Center actually it's a tool that they use the connect RV Center and it checks the statuses or virtual servers and then comes back and updates a catalog item with that and stuff like that so it can be used in so many different ways and use that data in so many different ways [Music] especially if it's a wrist rest calls are probably one of the again assuming there's decent support by the endpoint API or documentation you know which is the type anyway as long as it's got decent documentation it should not be hard to at least get it set up now manipulating the data to be what you want it to be that can be more time-consuming because we as we all know no no two people type even my name the same way so I'm trying to correct for user yeah ingenuity is what I don't type my own name or same way every time but whenever you're doing rest calls into service now have you used the rest Explorer I've only time I've used so that's that's more of an outbound that's what I'm at but you can also use it to get the what if you're like in the know if someone else was trying to do rest calls or posts back into your system they can use this to get what service nails would be yeah this is what I was trying to so I know if you can see the screen I can went through that really quick like but this is a great way to just it'll build out you can build it out however you want here I don't want my doing I'm retrieving records from incident a limited to one let's do ten and then you get the response back here's the actual data and you can if so if you're working with somebody here so this tells you everything you would need to know remember I said headers earlier here's the header they want an accept header they want a content type and the ex user token right so you would need to pass those and then if you wanted to see this you get ServiceNow Script if you're in ServiceNow wanting to talk to like another instance on a one-off you can click that and it'll show you the script on how to do that or if your yours JavaScript you know this would be if you're not in service now but let's say your mobile app or whatever is trying to get data from your ServiceNow instance you could do that with here's a JavaScript example for like I said in PowerShell it gives you the code just right there now you can copy paste and and try it out that's a really slick feature especially because these are you know very common for integration like I've done a lot of prior shell integrations it's kind of like the perfect middleman whenever you have two systems that could talk but either there's a knowledge gap or a support mentioned earlier about the support problem you know like we have an essay p1 that I was working on recently that there was no Smee there's no expert that we could get ahold of to help us with and I didn't have access no one on my team had access into the actual s AP instance so we ended up using PowerShell to do a bunch of xml calls because they simply have we had no support to be able to figure out how to actually get you know like while username how to do it yes sometimes you have to do what you have to do to get here get the stuff in there's a lot of nice modules so you may not even depending on what like Active Directory you don't even have to do anything fancy number by directories are pretty well supported by tourism but Perl and Python for the Linux boxes out there the curl is well curls very common one for Linux though me you got to remember that everything when you're talking about it get get the only thing really required is the accept header but if you're looking about at a post or a put or a patch or delete you're gonna have to do both accept and content-type is what service now requires and and so if you don't know all that stuff you click on one of these scripts and it tells you everything I mean that's the beauty of this is it right have to know you know what I just told you I know but I I didn't need to know that because I could just click on that script and get it so that does help you along the way so if you're not a hardcore you know developer or you're not somebody who is really experienced in doing API calls or doing integrations you know the reality is this does help you if you're from an external system but an internal system or from from internally or to pull from an external source it's a little more difficult yes this is mainly if you're trying to do pulls or pulls or pushes from somewhere into here it'll help with use it that side because you you've already set up the ServiceNow side that way you can go back and forth there's a zillion ways to do this I mean you've got to bring in data I've been working with SCCM recently and they have that built in integration but there are fields and values and things that we needed that weren't included in it well it's just it's it's a data source with it is a JDBC connection with a sequel statement if you can do those things it's very easy to set up an integration or expand an integration that ServiceNow already has to encapsulate more stuff that's great there's all sorts of internal-external I think we haven't covered soap it's another common one that works similarly kind to the way ref does yeah I really sold that one good nice what do you think is more stable though I mean honestly the if I'm working with secure data I want soap if I'm working with just retrieving if I'm working with something that I don't have to have not that security I wouldn't I mean they're both well they're not both asset to me soap is just a better option if you want to make sure everything is exactly the way it needs to be soap is not a very forgiving I'm gonna say language but that's not the right terminology their way of doing it yeah I can't think of any way more precise yeah it's very precise and rest you you have a lot more leeway it's all just strings there's no real format requirement like you can probably put them in whatever order you want like on the query parameters you know like you can get very unclean is so dirty you're not not worried about you know I mean I see this rest messages and I see that it's as secure as anything else that's in ServiceNow yeah I mean again you're doing everything over HTTP anyway so unless somebody's you know in your network already on that computer and then at that point you know good look I guess I mean they've already one if they've gotten there already so yeah soap again it's just it's more of a defined protocol area then then what I'm gonna say right but again neither one is like better than the other for all situations some things don't offer soap some things don't offer wrist like I said earlier the ulti pro they don't offer no not a knock on them but totally a knock on them they don't offer risk and you know if you're if you're a web-based tool that does not offer rest service to consume you know get out of being in business is my right yeah we're knocking them yeah not no knock on you know if I have to use informatica to talk to you stats but yeah so again so soap and rest not to knock on it's all gonna depend on what you have available for whatever tool you're trying to consume so if somebody if you don't go to somebody said I have to have rest because I heard this guy say it had to be more precise and I get better data you know that's you may not even have that option so don't don't it defined of depends on what you can use to actually you do what you have to even they may not have someone they may offer soap but they may not have you know an expert subject expert that you can talk to to actually get the right data to connect to it yeah yeah looking at us AP no [Laughter] problems because we're always you need certain bits of data sometimes from the sister you're connecting to and it's hard sometimes because you don't necessarily have the people that are willing to help you but there are ways around it and I'm not saying always go around it but sometimes you have to do it so yeah every integration is different we've all we've had our good integrations that we thought were going to be hard and we've had our hard integrations that we thought would be easy so you there's even those out of box integrations that are supposed to be just turn it on and go that end up being okay no we have to change a lot of stuff or yeah so or you give that you get it they're done any start configuring and nothing happens at all in or or everything happens three million records well this is why I used my this is all I used my sandbox when I'm doing my first connections another good point that Brenda's brought up if you're doing the background script testing you can have it record let me go back there and as long as you're on a a recent version you can record for rollback yep so when you run this if it updates those three million records you can then go to like smooth script execution history find the one like I ran this one here Oakland says of me what's going on here there we go and you can see this is the one I did it'll have another tab here that says like affected records or something along those lines yep and I'm you can see oh it did it really did do it did or whatever and then you can roll back this doesn't have the option to roll back because I didn't actually show state any records and we did an integration with a sequel database that had information on compliance on computers and we wrote that back in and we decided to send an email to people who are not complained now when you load it initially it could everything is non-compliant and switched everything to compliant and so we sent 10,000 emails so when you're running things to production you might turn off email just to be on the safe side yes always test in production right always always mark of an expert right there mark an expert a normal person would have tested that in like dev or tests and god oh god my inbox because I'm the admin well that's the thing and it was tested in in tests but they didn't have that when the flag was created it was it just was kind of a flute thing but no one that you should be able to prepare for those kind of things when you're updating a bunch of data you really got to think about how is it going to affect differently in production there are will in the other environments go to follow that up you don't just disable it I'm showing you the screen now it's under email properties under system properties although does this lead to the same one under mailbox or you can go to system mailbox administration email private I know that one was there it's same screen but you can disable more you knew yeah the email sending enabled uncheck that but then you also need to go to your mailbox delete them and the outbox empty the outbox before you turn it back on otherwise yeah but delayed the apocalypse I just made it worse because they'll have now every email will go out at once instead of maybe over the course of a few minutes or an hour right well I mean you know we live and learn on these things so you know oh by the way the outbox like that make sure that you check the other days also not just today because there could be no yeah look more emails and those will still send to so what you're saying is there's some personal experience there in trying to think if I did that or not I don't know I don't know I might have never had me from a previous day I'm dead well no I haven't did but I don't think I remember to delete him out I will have to say whatever I clone over I forget to do it and I'll go turn the email on and I'll start getting a hundred emails it's like oh crap yeah we actually have all of so I've seen a couple of different ways I've had it turned on and just pointed to me and put it in a separate folder randomly and beat it out whenever I go you get it gets a bunch the other thing is I've put it to a service account created a service account put it to the service account so everything so more people can view that service account we have access to it I believe you can put comma-delimited names in there so you can have it send to multiple people yeah oh yeah yeah yeah so I just randomly pick somebody in the corporation let it go to them and I just created a rule in my Outlook that whatever that yeah if it comes from never test it goes to a special folder and my yeah and an auto read yeah seeing nine thousand unread so what you're saying is you take the last person that made you mad and put thirty yeah actually I've never done that a reminder on my icing though yes to not put so I this actually happened last week we had your testing demand and we all have in tests I have all the emails turned off because all I do that all in dev and I only do tests when I'm actually between you know getting ready to actually push it up so we normally have it turned off and we'd had it off for probably two months because we were doing the upgrade and anyway they wanted to do testing on demand we put their name in here turned it on and this will do every if you use this area it does every single message mm-hmm true field or not right and clean out your outbox before you turn that on or your yeah your outbox because that's what happens to me as those come across when I forget to clear it out yeah so and when you have an actual instance you will have a lot of emails you didn't even realize we're being created yes from just random well the older the instance more problematic that is and we you know we have I worked with the the third customer service now and and there were my god there were emails those they had the most random there were like 1,100 or 1,200 emails in the system that got sent out for different things so it gets really complicated really fast I mean think about when you have like let's say you're using the incident module right every time you create someone creates an incident there's going to be an email to the person who created it an email to the team who received it an email possibly to the either the team or the individual if it was auto assign any time they like let's say if you have SLA is enabled as well then you're gonna have a bunch depending on how long the tickets been sitting in test untouched gonna get those starting to be generated fairly often mm-hmm I like how we've gone from integrations to talking on you know more about rest integrations reach out and yeah and we are here to help you so if you have a question or you need something you know our information is you know is available there to send us a message you know all are at us on LinkedIn really get connected with us and we'll give we'll try our absolute best to help you with whatever you need some issue I think we can we can help you with that as well I'd love to you know I think we'd all like to have live issues not production like not in your production apartment but you know actual problems to troubleshoot and go over on the on this podcast yeah absolutely yeah answering questions you know helping people out that'd be great weeds if you don't want it a couple times you know we can replicate no I'll depend core service now issue I guess but you know we can replicate whatever your issue probably is so it's one of our devs and in that way if you do not want to use production data you know if you have to worry yep we can try to replicate and you know to help things if security is a priority an organization yeah you know it's 2020 or whatever I think we've reached the end if you guys again if you need anything have any questions our information is there feel free to reach out to me directly or Randy and it is I guess we'll have have fun next time so give us a holler if you meeting them yep it's always a pleasure thanks everybody thanks thanks to you guys we want to thank our flagship sponsor for this show the sharp stone group LLC sharp stone is your source for all of your service now needs implementation development administration strategy and architecture contact the sharp stone group today at info at sharp stone group comm or four oh five five nine four zero one hundred we'd love to answer your questions or have you on the show contact us at service Sharpe at sharp stone group comm or find our linkedin info in the notes additional sponsorship opportunities are available you
https://www.youtube.com/watch?v=Qk9JnL3Xj0c