Have you ever wanted to know where to see your ServiceNow API calls?
You know that you’ve made an API call from ServiceNow, but you’re not seeing it in the system logs and you don’t know where to look.
There is a module called “Outbound HTTP Requests“, which shows all of the REST API calls that a ServiceNow environment makes. It will show what triggered the API call, what the endpoint was, and if you turn elevate logging at the REST Message level, then it will also show the request body and the response from the server. As well as the HTTP Status of the API request.
Make sure to set the log level to “All”, to show all of the response and request information.
View All API Calls in ServiceNow
To view all API calls in ServiceNow, follow this guide.
Also, it’s worth mentioning that this will show all REST API Calls that your ServiceNow platform is making/consuming to external sources. It does not show requests that are made, external to ServiceNow, attempting to consume data from ServiceNow. I don’t believe there is a single place to look at all API requests, coming externally.
Go to: System Logs > Outbound HTTP Requests
This will show you all of the Outbound REST API Calls.
It will look like this:
You’ll see the time that the API calls were made, and you’ll see the HTTP Status, which is super helpful.
If there’s an HTTP Status of 200, that is a successful API call and that means that you have set it up correctly. If you see an HTTP Status of 401, that means that you have a bad password/credentials.
In the Outbound HTTP Request form, you’ll see all of the following tabs: Log Level, Source, Request, Response.
You’ll see what in ServiceNow is triggering the REST API call, under the Source Record ID reference field.
So you’ll easily be able to tell what business rule or script include is responsible for making this call.
You’ll also see all of the out of box REST API calls that are made with every ServiceNow instance. There are a bunch of API calls that ServiceNow makes in the backend, that you don’t even realize, with every ServiceNow instance. So if you see some odd API calls here that you’re not responsible for, you can ignore them. I’m sure if you reached out to ServiceNow, they’d be able to provide some more information about them.
How To Show HTTP Request and HTTP Response
By default, REST API log levels are set to Basic, which does not automatically print request and response bodies from the server that are consumed. There is an easy fix to this.
If you have set the log level to basic, you’ll need to set it to All, to see all of the API information.
If you don’t see a Request or Response, you have to go to the REST Message itself that is making the API call, and you need to elevate the log level from Basic to All. You can set it back to basic after, if you’re making a ton of API calls. You should really only set it to All, if you’re debugging and need to refer back to it.
On the rest message record HTTP Method table [sys_rest_message_fn], you’ll find each REST Message method that you’ve setup. On this form, scroll down to the Related Links.
Under the Related Links, you’ll see the “Set HTTP Log Level” UI Action.
When you hit this, you’ll see a popup window that looks like this:
Set the HTTP Log Level to “All”.
Go ahead and make another API call, and then check the Outbound HTTP Requests module. You’ll see a new record in this table, with all of the data. You’ll see the request body and the response body from the server.
At this point, when you make another REST API call, you’ll see the request and response API bodies.
This is the best way to debug API calls from ServiceNow. It’s nice that it’s all in one place.
Let us know below if you have any other tricks around debugging and validating API calls in ServiceNow.
1 thought on “How To View Outbound REST API Calls In ServiceNow”
i want to know, how to solve this problem please.
Exception while executing request: null: com.glide.rest.util.RESTRuntimeException: Exception while executing request: null: com.glide.rest.handler.impl.ServiceHandlerImpl.handleInvocationTargetException(ServiceHandlerImpl.java:76)