Welcome Guest, you are in: Login

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

We do not currently have a dedicated Desk.com Connector for QlikView, however it is relatively straightforward to use our General XML/JSON API Web Connector to load data from the Desk.com API into QlikView.

If we receive sufficient interest in accessing this API we will consider adding a dedicated more streamlined and user friendly Desk.com specific connector for QlikView.

In these docs, we'll walk through a QlikView application, which you can download.


Authentication

The Desk.com API allows for both Basic and OAuth authentication, but with the General XML/JSON API Web Connector for QlikView we will only be able to work with basic authentication.

Open up the General Web Connector and in the URI input your Desk.com domain, i.e.
https://YOUR_DESK.COM_SUBDOMAIN.desk.com/api/v2/cases

Then in the username and password inputs at the bottom enter your details

Image

You should now be able to use the JsonToXmlRaw table and see that you're getting data back. In this case you'll be able to see a list of all your entries.

Image

Application

You can download the Zip file direct from here or you can visit the QVSource repository on GitHub here where you can track changes and download it.

The purpose of this application is to demonstrate how to authenticate and page through all your cases. This documentation explains how it was built up.

Authenticating within the Application

On downloading the QlikView application, opening it and going to the script editor you'll see at the start a small block of script which either looks for a credentials.txt file or takes some variables.

The credentials file won't exist in the download zip, because it's a file that only we use while testing and developing. So, to authenticate with your details please replace the [TOKENS] in the script with your credentials and subdomain.


//Replace the [TOKENS] with your details. The credentials.txt will not exist in your download as it's only used by ICB while developing the script
if isnull(size) then
	let vUserName = '[YOUR_USERNAME]';
	let vPasswordEncrypted = '[YOUR_ENCRYPTED_PASSWORD]';
	let vDeskDomain = '[YOUR_SUBDOMAIN]';	
else
	$(include=credentials.txt);
endif

Alternatively, you can create a text file named credentials.txt alongside the QVW file and enter the same three parameters in this file.

Paging Through Your Entries

After the standard url encoding function, the next function in the script creates a table of pages for the cases that you have. The default number of items per page is 50, but in this example we set it to 10 (because we had a fairly small data set to work with).

To find the URL for each page, we set the URI reqest

Image

If we then use the JsonToXMLRaw table and copy the URL generated

Image

Paste this into a web browser

Image

You'll notice that we have a section of XML called _links and in here we can see the urls for the next pages as well as the last page's url.

It is this section we are interested in, so back in QVSource set the XPath to DATA/_links and we'll only get that section back.

Image

We can then go to the JsonToTable table and select the qvx option

Image

This is then copied and used in the QlikView application with parameters used to construct the FROM url and some logic to ensure that we always get all the 'next' page URLs, which are then stored in a table to be used later.

Finding all the Entries

Now that we have all the page urls in a table, we can now loop through each of the pages and get the entries.

So, first get all the cases again with no XPATH defined

Image

and run the JsonToXML table again,

Image

Copy the URL and use QlikView's ability to read in 'Web Files' - as you navigate through the QlikView wizard, select XML and the DATA/_embedded/entries table. Although QlikView will insert 2 tables, we're only interested in the 'entries' table.

This 'entries' table can now be used within the paging loop.

Finally parts of the FROM statement were replaced with variables.

Building New Queries

By consulting the Desk.com API Docs you'll be able to build new queries to get the exact data that you want.


(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