How to use the Web API tile

The Web API tile allows you to pull data from external web sources and display this data as a scalar or tabular value. For example, retrieving a list of open incidents from ServiceNow, events from Splunk, or displaying figures from a CRM database.

The Web API tile can utilise any API which returns JSON. In particular, REST (Representational State Transfer) APIs, which are a type of stateless web API, are ideal. The tile can connect to services using various authorization methods (more details below).

Configuration

Provider Type

When creating a provider there are two types which control how the tile authenticates with the external API.

  • Simple: No authentication, basic authentication (username and password in a header) or Windows authentication (configured automatically to use the application pool identity account)

  • OAuth: Token-based authentication according to the OAuth 2.0 standard

Using a simple provider, we can pull back data from an external source and display this with ease. If the API only uses basic or Windows authentication then a simple provider will suffice.

Many APIs, including ServiceNow, use OAuth 2.0 for authorisation, and will require an OAuth provider to include the additional information about how to authorise against the service.

Display Options

You can choose to display the external data as either scalar or grid.

  • Scalar: a single value such as a number of customers or incidents.
  • Grid: a table of data, e.g. incidents.

HTTP mode or method

Both GET and POST requests are available through the Web API tile. The documentation for your web service will indicate which is needed, although typically this will be a GET request.

URL

This is the URL of the external web service and can contain query parameters, e.g. https://myservice/?filter=customers

Headers & Data

The Web API tile allows you to send additional data to the web service along with your request in the form of headers & data. Headers are HTTP headers and in the context of this tile, are typically used for authentication or specifying content types such as JSON.

You are also able to add additional data fields which are sent with the request. For a GET request these are sent as query string parameters, whereas for a POST request, they are sent in the request body.

Walkthrough: Configuring the Web API tile to show a JSON placeholder example

http://jsonplaceholder.typicode.com/ is a JSON REST API used for testing services and this example demonstrates how you would retrieve data from this API and show it using Squared Up.

  1. Browse to http://jsonplaceholder.typicode.com/posts The data shown is a list of posts which we can show in Squared Up as a table.

  2. Create a new dashboard and click on the Web API tile.

  3. Select Web API (Grid) and click next.

  4. Select generic from the drop down list for the provider, and click next.

  5. Paste the web address from step 1 into the URL box, and click next.

    For help customizing the columns of data see How to use the Grid designer when configuring tiles.

  6. Click done.

The data from the external API is now shown in Squared Up.

It is important to note that this data will refresh along with the rest of your dashboard and is great for showing tabular data such as a list of open support tickets or configuration changes.

ServiceNow

For guidelines and a walkthrough of how to integrate ServiceNow with Squared Up see How to use the Web API tile with ServiceNow.

Splunk

For advice and walkthroughs of integrating Splunk see How to use the Web API tile with Splunk.

How to use the Web API tile with ServiceNow

How to use the Web API tile with Splunk

How to use the Grid designer when configuring tiles label: How to use the Web API tile keywords: web oauth rest api fetch external ServiceNow service now