API Integration (Vizlib Actions)
As part of Vizlib Actions, our API Integration action lets you create a custom connection to a REST API of your choosing. This is an extremely powerful feature best set up by an experienced user or developer. Here's some ways we use it at Vizlib:
-
Sharing data from Qlik Sense into Slack
-
Tagging groups of features requests to move into development
-
Sharing data via email
-
Retrieving real-time metrics (before scheduled reloads)
This topic contains the following sections:
Getting Started with API Integration using Zapier
Check out our how-to video, with 5 easy steps to get started with API Integration. For those of you more familiar with APIs do read the known limitations. For those getting started with Zapier, everything is plug and play. Please note this requires a Zapier account and the premium package if you want to use webhooks. Other similar services are available.
Parameters
Parameters help define further instructions to your request. These are well explained here.
Typical URL containing a query string is as follow. The parameter "name" has a value of "ferret"
https://example.com/over/there?name=ferret
Authorization
Use this section if your API endpoint requires the following:
-
API Key/Secret
-
username/ID & password
Headers
Do not delete the header for authorization since this is automatically added upon entering details in the authorization tab. Limited headers are supported in browser-based REST API communications.
Body
Some requests support a text or JSON body. We allow an expression to be used (please beware you will need to use 3rd- party tools to validate JSON when this is an expression). using expressions means that a custom body can be used to drive a request, this can be driven by variables or selections, enabling you to provide end-users with a fast, bespoke and pain-free connection to other web services from within Qlik Sense. This could be updating other systems or sharing data via messaging tools like slack.
Settings
Many APIs will require to suppress content-type, since specifying certain headers is not allowed in simple REST requests (browser-based requests). Slack & Zapier accept only simple requests, this means that content-type headers must be disabled or set to text.
Possible Limitations
Some services will block browser-based requests entirely. One way around this is to use Zapier and use the Vizlib Button to GET/POST with a webhook. Once this is set up, a trigger can be linked to the webhook and another service to perform a standard server-based REST connection.
For more detail on this common limitation of browser based request, you can read more about CORS (cross-origin resource sharing) here.
For Ajax and HTTP request methods that can modify data (usually HTTP methods other than GET, or for POST usage with certain MIME types), the specification mandates that browsers "preflight" the request, soliciting supported methods from the server with an HTTP OPTIONS request method, and then, upon "approval" from the server, sending the actual request with the actual HTTP request method. Servers can also notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with requests.
If an API is working by creating a long URL, there are limitations for the number of selections you can include and the type of characters. More info here.
Variable Mode
insightsoftware has introduced the Variable mode feature in the API Integration action for Vizlib Button v1.9.1 to enable you to control how the software saves responses to variables. To find the Variable mode feature, you need to select a specific button from the Button Items and go to the API Integration action.
Before this feature. the software always saved responses to variables permanently and you couldn't change this behaviour. With the Variable mode feature, you can choose the following options:
- Auto—the software checks whether the user has privilages to update the response to variable and changes between Session save and Permanent save options. When no user privilege is detected, the software saves responses to variables temporarily, which means that data is lost after refresh. If there are user privileges, the software saves responses to variables permanently, which means that data is kept after refresh.
- Session—the software only saves responses to variables in session.
- Permanent—the behaviour of the software before the Variable mode feature was introduced. The software saves responses to variables permanently. If no user privilege is detected, the response isn't saved to a variable at all and the software displays information that the response couldn't be saved to variable.
- Disabled—The software doesn't save responses to variables at all.
Figure 1: Variable mode in the Property Panel