Web API plugin
The Web API plugin allows you to query data from any HTTP API that returns JSON, and then visualize that data. This is particularly useful if there isn't a SquaredUp plugin available for your data source.
Click the following link for additional content such as blogs, videos, use cases, and more:
For detailed instructions on creating Web API tiles, see How to configure a Web API tile.
For detailed definitions of data stream parameters, see Web API data stream parameters.
Adding a data source
To add a data source, open the relevant workspace and then 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 Add data source page.
Before you start
- Will SquaredUp need to connect to this data source via a relay agent?
- Configure the data source in SquaredUp
Will SquaredUp need to connect to this data source via a relay agent?
This plugin is a hybrid plugin, meaning it can connect to either a cloud or an on-prem data source.
- If your data source is available on the internet, then you do not need to connect via a relay agent.
- If your data source is on a private network and is not publicly accessible, then you will need to configure a relay agent before you configure the plugin. See Deploying a relay agent.
This feature is available with an Enterprise plan
Relay agents allow you to securely connect to data sources inside your own network (on-prem).
A relay agent is installed on a server on your internal network, and has access to your data source.
When a plugin uses a relay agent it means that you don't need to open your firewall to allow SquaredUp access to the data source.
If you have already created a relay agent in SquaredUp that can access this data source, then you can skip this step and choose Connect via relay agent when Configuring the data source.
Configuring the data source
For testing you could use the JSON Placeholder API. This is a JSON REST API that will show you some sample data: http://jsonplaceholder.typicode.com
Display name:
Enter a name for your data source. This helps you to identify this data source in the list of your data sources.
For example:JSON PlaceholderConnect via relay agent:
If you are connecting to an on-prem data source, select this toggle so you can use a relay agent to connect securely.Then, select the Agent Group that contains the agent(s) you want to use. Agent groups are managed from Settings > Relay Agents.
- Base URL:
Enter the base URL of the API to be used for requests.
For example you could usehttp://jsonplaceholder.typicode.comFor this sample API the provider needs no further configuration so just click Add and then go to Configuring a Web API tile. - Query parameters:
Optionally, add any parameters that should be added to the Base URL. You may prefer to add these in the tile configuration so you can use different queries on different tiles. - Headers:
Optionally, click to configure headers for the request. Enterkey:valuepairs for each of the headers you add. - Authentication:
Choose how to authenticate the connection. Choose from:- None: No authentication required.
- Basic: You must enter a Username and Password.
- Digest: Enter a Username and Password to use with Digest authentication, which ensures that passwords are hashed and mitigates replay attacks.
- 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.
Specify the details for your required OAuth 2.0 flow. For more detailed information see OAuth 2.0 Configuration.
- Client ID:
Enter the ID provided by your client application. - Client Secret:
Enter the secret provided by your client application. - Authorization Scope:
Enter your required access scopes for the third-party application server you are using. For example, if you are using the Web API plugin to access thehttps://www.googleapis.com/API and you wish to use thedrive/v3/filesendpoint, you can use the authorization scopehttps://www.googleapis.com/auth/drive.readonly.
If you require more than one scope, you add them all here separated by spaces.The Web API plugin requires offline access to be requested, which requires the correct scope to be entered, dependent on the authentication server being used:
- Atlassian: Request the
offline_accessscope. - Google APIs: Offline access isn't requested via a scope at all. Instead, you must add the
access_type = offline and include_granted_scopes = truequery arguments to the Authorization URL.
- Atlassian: Request the
- Configure the Token section as follows. These fields define how your application requests an access token from the authorization server:
- Token URL:
Enter the URL of the third-party authentication server you are using. For example,https://oauth2.googleapis.com/token. - How to send credentials to the Token URL:
Select where you want the client credentials you entered above to be included in the OAuth 2.0 request. - Query parameters:
Specify any additional parameters that must be appended to the token request URL askey:valuepairs. - Headers:
Define any HTTP headers that must be included in the token request askey:valuepairs. - Send access token in query parameters:
Enable this for services that require the access token as a query parameter. When disabled, access token is supplied as an Authorization Bearer header.
- Token URL:
- Configure the Authorization section as follows. These fields define how your application obtains authorization tor resources using OAuth 2.0:
- Grant Type:
Select the OAuth 2.0 flow you need to use. Choose from:- Authorization Code: Enter the Authorization URL of the authorization server you are using (for example,
https://www.googleapis.com/) and then click the Sign In button below. You are redirected to the authorization sign in page.
Upon returning to SquaredUp , if the request was successful, the Sign In button shows you as logged in. - Client Credentials: No additional details are required.
- Password: You must enter a Username and Password.
- Authorization Code: Enter the Authorization URL of the authorization server you are using (for example,
- Grant Type:
- Client ID:
- JWT Bearer: Uses a signed JSON Web Token (JWT) to obtain or present bearer credentials for authentication. Commonly used for service accounts and server-to-server API integrations.
Specify the details for your required JWT Bearer flow.
- Add token to:
Select where the generated JWT should be included in API requests. Choose from:- Request Header: Adds the JWT to the
Authorizationheader. - Query Param: Adds the JWT as a query string parameter in the request URL. When selected, the Query parameter name field displays. Use this to specify the name of the query parameter to attach to.
- Request Header: Adds the JWT to the
- Algorithm:
Select the signing algorithm used to generate the JWT signature. This must match the algorithm expected by the target API. - Secret:
Enter the secret, private key, or signing key used to generate the JWT signature. The required format depends on the selected algorithm. - Secret is base64 encoded:
Enable this option if the configured secret is Base64-encoded. The secret will be decoded before being used to sign the JWT. - Payload:
Enter the JWT payload (claims) as a JSON object. The payload is included in the JWT body before it is signed. - Show advanced JWT settings:
Select to display the following additional JWT configuration options:- Request header prefix:
The prefix applied when adding the JWT to a request header. For example,BearerproducesAuthorization: Bearer <token>. Leave blank to send only the token value. - JWT headers:
Optional JSON object containing additional JWT header values, such askid,typ, or other API-specific header claims.
- Request header prefix:
- Add token to:
- Scripting:
Enable this option if you need to run a JavaScript pre-request script before each data stream request. This allows you to perform custom authentication flows, generate request signatures, or modify request headers before the request is made:- Secrets:
Define values that your script can access, such as API keys, tokens, or signing secrets. Click Add variable to create a new secret key-value pair.
Click the padlock next to a value to encrypt it when stored. This is recommended for sensitive information such as API keys, client secrets, and authentication tokens.
These are accessed in your script via thesecretsobject. For example:const token = secrets.apiToken; const keyId = secrets.keyId; - Pre-request script:
Enter the JavaScript to run immediately before each HTTP request is sent by the data source. For example, to add an authorization header using a stored secret:headers["Authorization"] = `Bearer ${secrets.apiToken}`;The following variables are available to pre-request and post-request scripts. Some variables are writable and can be modified by the script, while others are read-only.
- Secrets:
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.- Test endpoint:
Optionally, you can select Test endpoint to run a test request and see an example payload.Enter the details of an endpoint you'd like to run a test against to see what is returned. The information entered here is only used for the test.
- Endpoint path to test:
Enter an endpoint path. - Additional headers for the test:
Enter any additional header names and values to be used for the test. - HTTP method for the test:
GET or POST - Query arguments for the test GET:
If you chose GET you can optionally add any query arguments to be used for the test.
For example, for the JSON placeholder API you would useGETand/postsor/usersor/albums - Body for test POST:
If you chose POST you can optionally enter a JSON string representing the body of the POST request. - Click Send.
- The Result box will show the resulting payload.
- Endpoint path to test:
Restrict access to this data source:
Optionally, enable this toggle if you only want certain users/groups to have access to the data source, or those with the permission to link it to new workspaces. See data source access control for more information.- Click Add.
Testing and troubleshooting
You can use the Test endpoint section of the plugin configuration (see above) to check the available endpoints and view the resulting data.
When configuring the tile it's really helpful to open the Troubleshooting panel by clicking Open troubleshooting
at the top of the parameters panel, see How to configure a Web API tileIf you encounter an error refer to the guidance or contact our support team in-app or via SquaredUp Support
For errors on dashboard tiles see Troubleshooting tiles.
Next steps
Data streams
You can use these data streams to create new tiles to show data, or if there are preconfigured dashboards installed you can copy or edit those.
Data streams are named queries targeted at a data source, typically mapped to a specific API endpoint. They define how SquaredUp retrieves live data. By standardizing information from diverse formats into a simple table, data streams provide a consistent starting point regardless of the original source system.
Each plugin includes its own set of data streams. When editing a tile or exploring data, the data stream you choose acts as the entry point to the objects and records within that data source.
Scoped data streams allow you to specify which objects you want to pull data for. Global data streams return general information that is not tied to objects.
Some data streams are configurable, meaning you can configure additional settings on the Parameters tab of the tile editor to create a bespoke query.
When you're creating a tile, you can tweak data streams by grouping or aggregating specific columns.
See Data Streams for more information.
The following data streams are installed with this plugin.
Configuring a Web API tile
Web API tiles are configured via the tile editor the same as every other data source, however the complexity of the configuration itself can vary significantly depending on the API you are accessing.
In some circumstances, the information you provided when configuring the data source may well suffice to return the data you need. In others, you may be required to include an endpoint, payload, query parameters, headers or paging details.
Each of these are configured on the corresponding sub-tab via the Parameters tab of the tile editor.
For full detailed instructions on building out your Web API tile's HTTP requests, see How to configure a Web API tile.
For detailed information on each configuration setting, see Web API data stream parameters.