Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Qlik Sense Cookbook

You're reading from   Qlik Sense Cookbook Over 80 recipes on data analytics to solve business intelligence challenges

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788997058
Length 334 pages
Edition 2nd Edition
Arrow right icon
Authors (3):
Arrow left icon
Philip Hand Philip Hand
Author Profile Icon Philip Hand
Philip Hand
Neeraj Kharpate Neeraj Kharpate
Author Profile Icon Neeraj Kharpate
Neeraj Kharpate
Pablo Labbe Pablo Labbe
Author Profile Icon Pablo Labbe
Pablo Labbe
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with the Data FREE CHAPTER 2. Visualizations 3. Scripting 4. Managing Apps and the User Interface 5. Useful Functions 6. Set Analysis 7. Using Extensions in Qlik Sense 8. Advanced Aggregation with AGGR 9. Tips and Tricks 10. Other Books You May Enjoy

Extracting data from web services with REST Connector

Qlik Sense provides connectivity to several data sources, such as SQL databases, Excel files, and text files, but we also have an increasing need to connect to web services that provide data in the JSON or XML format. This recipe shows you how to configure a REST connection to retrieve data in the JSON format from a public web service with data related to the Star Trek Series.

For this recipe, we will use a URL to extract all the Star Trek movies. When extracting the data from a REST data source:

  1. Open an existing Qlik Sense application or create a new one.
  2. Open the Data load editor.
  3. Click on Create new connection and select Qlik REST Connector.
  4. The Qlik REST Connector configuration window will open.
  5. Insert the following URL from which you can fetch the data: http://stapi.co/api/v1/rest/movie/search.
  6. Set up Authentication Schema as Anonymous.
  1. Name the connection as QlikSense Cookbook REST, as shown:
  1. Click Test Connection to check whether the parameters are OK.
  2. Click Create to create the connection and close the configuration panel.

How to do it...

  1. In the list under Data connections, select QlikSense Cookbook REST and click on Select data. This will open a preview window listing the tables found in the JSON response from the web service. When you carefully examine the table contents, you realize that it is a root node, and when you expand the node, you find a movies node.
  2. Check the box next to movies and ensure that it is selected, so that the correct table is shown in the preview (when working with JSON data sources, we always have to expand the nodes to find the right table to be extracted).
  1. The preview of the table will look like the following screenshot:
  1. Save and load the data. Once the script is successfully loaded, the Data model viewer will show the loaded tables.
  2. Click on Insert script to load the JSON data in the application.
  3. Several commands have been inserted in the script.
  4. The main one has a name of RestConnectorMasterTable. This table contains the JSON data in a flattened format.
  5. Two more tables are created by a resident load from the mainDirector main table and movies. In the end, the RestConnectorMasterTable main table is dropped from memory.

How it works...

Qlik Sense connects to the REST service using the stored data connection. Once connected,

it identifies the source formats and lists them in the preview window.

JSON data sources contains nested data with several children records. Qlik Sense creates a multi-table schema when the source contains nested data.

There's more...

Qlik Sense REST Connector can also extract data from other data formats, such as XML and CSV. The underlying principles remain the same as explained in the preceding recipes. You can also extract data using authentication methods, the POST method for SOAP web services, or the pagination method to retrieve a large amount of data.

See also...

  • The Creating a master library from the Data model viewer recipe
You have been reading a chapter from
Qlik Sense Cookbook - Second Edition
Published in: Aug 2018
Publisher: Packt
ISBN-13: 9781788997058
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime