Web API On-Premise plugin

The Web API plugin allows you to query data from any HTTP API that returns JSON and visualize that data. This is particularly useful if there isn't a SquaredUp plugin available for your data source.

The Web API On-Premise plugin allows you to add a data source that connects to an API on your internal network.

If you're not accessing the API on your internal network, you should instead use the cloud Web API Plugin.

This article covers:

How to add a data source using the Web API On-Premise plugin

Writing a custom data stream (advanced users)

How to add the data source

To add a data source click on the + next to Data Sources on the left-hand menu in SquaredUp. Search for the data source and click on it to open the Configure data source page.

This is an on-prem data source.

Configuring and deploying an agent

If you have already created an agent in SquaredUp that you can use for this data source, you can skip this step and choose the agent group you want to use while adding the data source.

See one of the following, depending on your platform type:

Configuring the data source

  1. Display Name:
    Enter a name for your data source. This helps you to identify this data source in the list of your data sources.

    You may find it useful to put the API URL in the display name.
  2. Agent Group:
    Select the Agent Group that contains the agent(s) you want to use.

  3. Base URL:
    Enter the base URL of the API to be used for requests, for example https://www.googleapis.com/
  4. Query arguments:
    Add any parameters that should be added to the Base URL.
  5. Authentication:
    • None: No authentication required.
    • Basic: You must enter a Username and Password.
    • OAuth 2: Token-based authentication according to the OAuth 2.0 standard. Many APIs use OAuth 2.0 for authorization, and will require an OAuth provider to include the additional information about how to authorize against the service. If this option is selected, follow the steps in Configure OAuth 2.0 below.
  6. Headers can be added if required.
  7. Ignore Certificate errors:

    If you activate this checkbox the data source will ignore certificate errors when accessing the server. This is useful if you have self-signed certificates.

  8. Test endpoint:
    Optionally, you can tick Test endpoint to run a test request and see an example payload.
  9. Optionally, select whether you would like to restrict access to this data source instance. By default, restricted access is set to off.

  10. Click Add.

Using the Web API data streams

Data streams

The following data streams are installed with this plugin.

HTTP Request

The Web API plugin adds one configurable data stream (HTTP Request) which allows you to create a global data stream to query data from any HTTP API that returns JSON.

The steps for creating the data stream are very similar to those for the Run test endpoint test (when adding a Web API data source), with a couple of additional fields:

  1. Add a new data tile and scope to an instance of a Web API data source.
  2. Choose the + <Web API instance name> - HTTP Request data stream.
  3. Display Name:
    Enter a name for this data stream.
  4. The Base URL from the Web API instance is shown.
  5. Endpoint path:
    Enter an endpoint path.
  6. Additional headers for this request:
    Enter any additional header names and values to be used.
  7. HTTP method:
    Select GET or POST
  8. Query arguments for GET:
    If you chose GET you can optionally add any query arguments to be used.
  9. Body for POST:
    If you chose POST you can optionally enter a JSON string representing the body of the POST request.
  10. Click Send. The Result box will show an example of the resulting payload.
  11. Path to data:
    This is where you enter the location of the results set that is returned. The Result box shows you a preview of the data returned, so you can check the location of the data returned, and use that in the Path to data.
  12. Expand inner objects:
    Objects inside the requested data path will be used to make extra columns of data.

Writing a custom data stream (advanced users)

You may wish to create your own custom data stream for an HTTP Request using the information below. When writing your own data stream you can choose either a global or scoped entry point. You will need to write your own custom data stream if you want a scoped data stream, because the configurable data stream HTTP Request can only create a global data stream.

  1. In SquaredUp, browse to Settings > Advanced > Data Streams.
  2. Click Add custom data stream.
  3. Add your custom data stream by entering the following settings:
    1. Name:
      Enter a display name for your data stream.

      The display name is the name that you use to identify your data stream in SquaredUp. It has no technical impact and doesn't need to be referenced in the data stream's code.

    2. Data source:
      Choose the data source this data stream is for.
      After you've chosen the data source the Entry Point field displays.
    3. Entry Point:
      Specify the data stream entry point and enter the Code below.
      To find out which entry point to select and get code examples for the Code field, see the help below.
  4. Click Save to save your data stream.

Was this article helpful?

Have more questions or facing an issue?