Hi SquaredUp Community,
Just wondering if it is possible to get SquaredUp talking to ServiceNow? I want to add a web part on one of my dashboards to show how many incidents/changes, etc are open overall.
Squared Up v3 can connect to ServiceNow using the Web API tile. There are a couple of prerequisites, which are:
- Squared Up v3 with an Enterprise Application Monitoring license – this gives you the Web API tile! The Squared Up server must have access to your ServiceNow instance on port 443 (HTTPS), since it is the server that connects to ServiceNow, and not your users’ browser.
- A ServiceNow instance. You may need some help from a ServiceNow admin to get an account with the correct privileges. Your ServiceNow user must have the “web_service_admin” role (https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/inbound-rest/reference/r_RESTAPIRoles.html) and check “Allow access to this table via web services” (https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/inbound-rest/concept/rest-table-access.html)
Once these prerequisites are sorted, the rest of the process is pretty seamless:
- In the Application Navigator (left-hand menu) go to System OAuth and click Application Registry.
- Click Create an OAuth API endpoint for external clients
- Call it something like “Squared Up” to make it easier to remember, all the other defaults should be fine
- Once you’ve made it, open the entry to view the client ID and secret (click the padlock next to the client secret to see it!) and copy these into a notepad for later
In Squared Up:
- Go to the settings page, and click on the Web API section
- In the top right-hand corner, click Add Provider
- We’re creating an OAuth provider, so select that option, and fill in a suitable name (ServiceNow seems sensible)
- The base URL should look something like https://instancename.service-now.com/api/now/ (replace instancename with your instance, and if you have an on-prem setup, which may be something different!) – this is prepended to every request URL
- The token URL will be something like https://instancename.service-now.com/oauth_token.do
- The grant type is Password – ServiceNow have some pretty confusing docs on this, but this is the only one (other than Basic Auth) which I’ve managed to get working
- Username and password are exactly those used to sign into the account which was setup with the permissions mentioned in the prerequisites
- Client ID and secret are taken from the notes you made earlier
- Leave the scope empty and add that provider!
If all has gone well, and all the permissions are beautiful and correct then you will get an amazing green tick as a reward! This means you’ve got everything working successfully – well done!
For now I’ll leave you with a really simple tile: lets get a count of the open incidents! Make a new tile and follow along (we’ll be using the docs from here: https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/integrate/inbound-rest/concept/c_AggregateAPI.html) :
- Create a new tile, select the type Web API as Scalar – because we’ve got a numerical representation of a piece of data
- We can make this a GET request to “stats/incident” – remember that the base URL is prepended to our URL!
- In the data section, we should add a couple of parameters to our request to zone in on the correct data:
- “sysparm_count”: “true” (get me a count of this data)
- “sysparm_query”: “active=true” (open tickets only)
- In the response data, we need to pick out the right piece of the data. In this case, it turns out to be “result.stats.count” – this should complete our tile!
Reply in the comments if you’re having any issues with this, I can go into more details of grabbing tables if you’d like!