REST API Explorer - Did You Know
foreign with another did you know and this time I am joined by advisory solution consultant Dan synott how are you today Dan I'm doing great Chuck thank you so much for having me here today it's a pleasure hey uh you had come to me a while ago and said I've got this collection of things we call Underdog features big old deck and I said let's take one of those for an episode of did you know because they sound just like did you know you were telling your customers hey did you know if you do this you could like yeah yeah yeah yeah yeah yeah let's do that so what have you got for us on this one well today I have something for our developer friends and this is something Chuck that this is probably near and dear to your heart let me ask you a question have you ever tried to write an API call uh into servicenow ever ever I mean yes it's one of my favorite things to do I thought I saw a video or two of you doing that in the past as a lot of our customers know and and users of the platform know you know we have extensive documentation around our apis out on the developer website I mean we can take a really quick look by going to the developer site under reference you know we have a rest API calls and there is just a boatload of information out here right let's go to take a look at our uh our probably our favorite API call if we just want to get information from the table API um but if we go down here and we just want to get a simple uh record from a table look at all this fun information I mean it's great great reading um very detailed um very detailed very detailed very detailed doesn't quite have a Pulitzer Prize yet but I mean very very good in terms of of documentation but there's a lot to know just to write a rest call oh hey through curl right our favorite yeah this is a common way that most rest API document presents an example as a curl command because it's kind of universal thing and you get the response payload back of what you could expect so very common here but I suspect you're going to show me a better way yeah well did you know that there's actually a capability built into the platform called the rest API Explorer I knew that but maybe not all our viewers know that let's make sure we change that right now let's go take a look at the rest API Explorer well Dan this certainly looks familiar sure does landing page on our servicenow instance that that we'll be using today but uh what we'll take a look at is the rest API Explorer to get there as you would probably guess you filter for the rest API Explorer and once you click on this you'll be taken uh to this wonderful interface that that really it shows every single API endpoint on the platform now now as we take a look at the namespaces you'll see the global you'll see the now but you will also see the custom name spaces that you may have created by creating new rest or I'm sorry scripted rest apis which are endpoints or even using the rest trigger that is now available in flow designer if you have not used that you gotta check it out it's it's I had you know until you showed me I did not know that so I'm I've got a Dyk right now it is one of those things the kids have it so easy these days man I'm telling you but what we'll do is is since we looked at the table API in the documentation let's take a look at what that looks like in the rest API Explorer so you can see right now we have the namespace we have the table API pulled up we can see we can get we can do a post we can do other gets we can do more puts and deletes and patches and all that fun stuff we'll keep it hang on there's something right below though that I did not know another this is two two in one episode you can export this this open API spec which you can then import into another product now I've gone to certain third-party rest API pages and they say download our yaml file and you can import that right into integration Hub it is a huge Time Saver so you can export these from servicenow to help somebody else build an integration faster to service okay wow Blown Away back to your script where were we going with this I'm telling you it just keeps getting better and better so let's just do a really simple get call against everybody's favorite table in servicenow that's the incident table we're just going to Simply get a a quick record out of here but you can see all the different query parameters that you can put in that were extensively documented on the docs site it's all here you can modify those to your content as you're testing things out and understanding what the payloads are well you've got descriptions on the right hand side also so you don't necessarily need to go running back to the doc site to go what was cisparm fields for oh yes it's a comma Set Radio pretty easy exactly and once once you have everything set up and you're ready to go you just hit this wonderful send button here and as you scroll down towards the bottom you're going to get your response information last I checked at 200 okay is certainly okay green is good green is good uh it gets General execution times all your Header information and most importantly your Json result uh with the body and and all the subsequent information that you requested and I love that the reference Fields also have a link to them so you could put this into another rest request and do your own method of dot walking to say I want to go down and get the CI There's the link pop it into another get and you've got all the rich CI information and you go oh it has a department on it let's dot walk to that so you could do this it's going to take two or three calls to do it but yes the the links are right there complete with the table API already spelled out for you alrighty set up and ready to go it's it's a thing of beauty now interestingly enough uh as much as we would like the entire ecosystem to be using servicenow to do all their API calls it is likely that you may have other systems other programming languages that you're trying to interface into servicenow you know what we play well with others so well in fact that if we go up uh right above here we will even give you pre uh factored code for all these different languages so whether it's a servicenow script if you want to do a curl command Python's everybody's favorite right now even going going old school with some Pearl but if we take a look at uh click on the python script you'll see everything you need right here ready to go just put in your new credentials admin admin is not my username and password sorry you little slack guy what they're watching right now I love this because I'm not a python programmer I've looked at it and I've attempted a hello world but you can hand this to the python programmer in your organization or even if you don't know it you could copy and paste this and do a few modifications that look like a hero either way yeah you will certainly be a hero to your uh your corporate developers because uh you can just hand them what they need it makes this ecosystem such an easy one to tie into which is what we all want Dan this is great thank you very much for showing us the rest API Explorer and I can't wait to talk to you again about another feature I'm looking forward to it foreign
https://www.youtube.com/watch?v=NeO9UPeSMlA