Welcome Guest, you are in: Login

QVSource: The QlikView & Qlik Sense API Connector (Docs)

NOTE: You could also use the General Web Connector (which is commercially available and supported) to connect to the many APIs hosted on Mashape by setting the X-Mashape-Key: XXXXXXXXXXXXXXXXXXXXXXXXX header and currently has more features than this connector.

Note that the screen shots on this page no longer reflect the latest version of this connector which has now been updated to the new UI style.


The Mashape Connector for QlikView and Qlik Sense allows you to connect to any API hosted at Mashape.

For example:
  • This blog post shows 16 Sentiment Analysis APIs available on Mashape.
  • This post shows 40+ Machine Learning APIs.
  • This wiki post shows how to use the rome2rio API to get routing information between two points.

This connector should allow you to leverage these APIs and others from QlikView and Qlik Sense.

This connector is currently quite similar to the General JSON/XML Web Connector with the exception that it can authenticate with Mashape APIs. We expect to add additional Mashape specific features in the future and so it has been deployed as a separate connector.

Usage

Before using the Mashape Connector it is important that you set up an account with Mashape and enter your API key into the Connector as explained here.

You will also probably need to subscribe to the API you want to connect to through the Mashape interface.

Example Usage

In this example we will connect to the Ip2Country API which should allow us to convert IP addresses in our QlikView application to country names and also retrieve the flag for the country.

The first step is to locate the base url for the service. To do this we click the 'Plain REST' button on the documentation:

Image

And then copy the 'API Base URL':

Image

Which in this case is:
https://orfeomorello-ip2country.p.mashape.com

Next we need to grab the remainder of the url for the particular method we would like to call. In this case there is only one possibility, as highlighted below:

Image

We combine this with the base url to get the full url needed for QVSource:
https://orfeomorello-ip2country.p.mashape.com + /mashape/ip2country/ipv4/{ipv4}/key/{key}/imageFormat/{imageFormat}

=

https://orfeomorello-ip2country.p.mashape.com/mashape/ip2country/ipv4/{ipv4}/key/{key}/imageFormat/{imageFormat}

Before entering this into QVSource though we need to replace the two arguments {ipv4} and {imageFormat}. The latter argument is actually optional but we will use it anyway.

So let's enter a test IP address of '95.131.110.124', an image format of 'png' and the key as 'QVSource' to give:
https://orfeomorello-ip2country.p.mashape.com/mashape/ip2country/ipv4/95.131.110.124/key/QVSource/imageFormat/png

And then enter this into QVSource:

Image

Notice that the request is configured as a GET as per the documentation for this particular API.

It is important when connecting to other Mashape APIs to carefully check the documentation as many of the APIs expect a POST request and will often need the parameters entered in the 'Post Parameters' input in QVSource.

Now we have entered this we can test the request on the Data tab.

Image

The above shows the raw json response from the API. This is not directly usable in QlikView but we can pick the JsonToXmlRaw table - this then gives a url we can load directly into QlikView:

Image

However, even easier to use is the JsonToTable option which will attempt to convert the response into a structured table:

Image

Note that depending on the structure of the XML/JSON returned you might need to specify an XPATH value here to extract the correct table - you can see an example of this on the General Web Connector. In this case the response is very simple and so this is not necessary.

We can now use the standard QVSource work flow of copying the script and using it in QlikView:

Image

The important thing to remember here is that the IP address input parameter is part if the load script:

...
FROM
[http://localhost:5555/QVSource/MashapeConnector/?table=JsonToTable&verb=get&url=https%3a%2f%2forfeomorello-ip2country.p.mashape.com%2fmashape%2fip2country%2fipv4%2f95.131.110.124%2fkey%2fQVSource%2fimageFormat%2fpng] (html, utf8, embedded labels, table is @1);

So typically in your QlikView load script you would need to construct a for/next loop to loop through all the IP addresses in your data set and replace this value each time the API is called.

As a final tweak we could also set the cache parameter to cache the results indefinitely or at least for a long time as it is unlikely the IP address will change country very often.

Image

It is important that we now regenerate the load script or indeed whenever we make changes to the input configuration as this will result in corresponding changes to the request url to QVSource.

API Status

If you are having issues connecting to a Mashape API, please check their live API status page before submitting a support request.

Change Log

0.8.2 - 25/05/15
  • You should regenerate your load scripts when updating to this version.
  • Upgraded to latest UI style.
  • Added content type input parameter.
  • BREAKING CHANGES
    • QVX is now the default response format (previously it was HTML). Ensure you upgrade to use QVX format (recommended) or use &format=html in your requests (not recommended).
    • Cache time in hours will now accept integers only.

0.8.1 - 10/06/13
  • Private API key entry removed, Mashape have changed their authentication and this is no longer needed.

0.8.0 - 25/06/12
  • Initial version.
  Name Size
- base url.png 14.10 KB
- basic request.png 5.79 KB
- cache forever.png 8.07 KB
- copy script.png 29.74 KB
- ip2country url.png 8.39 KB
- json to table.png 13.51 KB
- mashape config.png 12.96 KB
- plain rest.png 15.10 KB
- raw json.png 17.82 KB
- raw xml.png 20.12 KB


(QVSource works with Qlik Sense as well as QlikView - See this page for notes.)
QVSource - The QlikView & Qlik Sense API Connector | © Copyright 2011 - 2016 Industrial CodeBox Ltd