Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW

Connecting to the QRS API using the Qlik REST Connector

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Pilla
Employee
Employee

Connecting to the QRS API using the Qlik REST Connector

Last Update:

Dec 28, 2016 4:22:39 PM

Updated By:

Daniel_Pilla

Created date:

Dec 28, 2016 4:22:39 PM

Attachments

A tutorial covering connecting to the Qlik Sense QRS API via the Qlik REST Connector -- covering both local and remote connections.

Comments
maxime_auvray
Partner - Contributor II
Partner - Contributor II

Hello Daniel,

Your documentation is really great.

I managed to connected myself to the API with the POSTMAN tool on Chrome. But with the same parameters, all I got is
"Test Connection

Failed to connect to server"

------
Here is the log when I use Postman:

5012.22.3.020170707T162823.031+0200INFO<servername>c0910e1d-ebe4-454a-bdb8-05244ab2d4e1Command=Stop repository;Result=0;ResultText=Success000INTERNALSystem0Not availableRepositoryNot availableNot availableStop repository0Teardown of Core Repository completed.c0910e1d-ebe4-454a-bdb8-05244ab2d4e1

And here is the log that I get for the REST connector (with the exact same parameters):

5112.22.3.020170707T162824.144+0200WARN<servername>a1ea961c-5aa1-402d-9906-11d5a3472e23Command=Check service status;Result=500;ResultText=Error: Impossible de se connecter au serveur distant000INTERNALSystem31e3183d-b937-4497-ad4b-40ff1f7aa66fCentralRepositoryNot available/qrs/servicestatusworkerCheck service status500Method: 'SendServiceStatusRequest'. Failed to retrieve service status from 'https://servername:5151/qss/'. Server host 'mauvray-pc'. Error message: 'Impossible de se connecter au serveur distant'a1ea961c-5aa1-402d-9906-11d5a3472e23
5212.22.3.020170707T162824.162+0200WARN<servername>d414f9f3-4966-4fbc-97f7-55cf43b41294Command=Check service status;Result=500;ResultText=Error: Impossible de se connecter au serveur distant000INTERNALSystem31e3183d-b937-4497-ad4b-40ff1f7aa66fCentralRepositoryNot available/qrs/servicestatusworkerCheck service status500Method: 'SendServiceStatusRequest'. Failed to retrieve service status from 'https://servername:4243/qps/'. Server host 'mauvray-pc'. Error message: 'Impossible de se connecter au serveur distant'd414f9f3-4966-4fbc-97f7-55cf43b41294
5312.22.3.020170707T162824.171+0200WARN<servername>89b6455d-e48f-48c4-ba4b-45d8f092e587Command=Check service status;Result=500;ResultText=Error: Impossible de se connecter au serveur distant000INTERNALSystem31e3183d-b937-4497-ad4b-40ff1f7aa66fCentralRepositoryNot available/qrs/servicestatusworkerCheck service status500Method: 'SendServiceStatusRequest'. Failed to retrieve service status from 'https://servername:4899/printing/'. Server host 'mauvray-pc'. Error message: 'Impossible de se connecter au serveur distant'89b6455d-e48f-48c4-ba4b-45d8f092e587

So if you have any idea of the problem, I'm will be glad to hear the answer !

0 Likes
ChristofSchwarz
Partner Ambassador
Partner Ambassador

Hi Daniel. This looks like exactly what I am looking for: A way to get Sense server infos from the reload script itself using the QRS API. However, I tried on 2 sandboxes, one being a Sense 3.0.1 and one being a Sense June 2017 release, both rejected to set up the REST connection. Do you have an updated instruction? The screen shots inside your PDF do not match the current (meanwhile pre-installed) REST connector ..

screenshot.2017-10-04 (13).jpg

0 Likes
bramkn
Partner - Specialist
Partner - Specialist

Hi dpi

Could you please add on to this example. And show how to do a post call in sense script/rest connector?

I am trying to create customproperties for example. Can't figure it out.

0 Likes
Daniel_Pilla
Employee
Employee

Bram,

Here is an example using our REST connector with the example payload found here: https://help.qlik.com/en-US/sense-developer/February2018/Subsystems/RepositoryServiceAPI/Content/Rep...

REST1.png

REST2.png

REST3.png

Result.png

0 Likes
bramkn
Partner - Specialist
Partner - Specialist

Hi Daniel,

Thanks for the quick responds.

I The Qlik client certificate isn't an option in the list for me. I have tried the possible certificates but get an error: "client certificate invalid" Do I have to setup the certificate somehow? I want to get this working on the server it self not on an external machine, so not sure why the server doesn't get its own certificate.

0 Likes
Daniel_Pilla
Employee
Employee

Hi Bram,

You need to export the certificates from the QMC and import them where needed.

https://help.qlik.com/en-US/sense/February2018/Subsystems/ManagementConsole/Content/export-certifica...

You will then need to import certain certificates to the appropriate machine.

Quick Google'd link if you are unfamiliar: HowTo How To Import Personal Certificate With MMC

If you are connecting to your Qlik Sense Server over the browser:

  • Import the client certificate into the Qlik Sense Server's Certificates (Local Computer)->Personal->Certificates

If you are using Qlik Sense Desktop and connecting to your server remotely:

  • Import the client certificate into your remote machine's Certificates (Local Computer)->Personal->Certificates
  • Import the root certificate into your remote machine's Certificates (Local Computer)->Trusted Root Certification Authorities->Certificates
0 Likes
bramkn
Partner - Specialist
Partner - Specialist

Thank you very much

Any way to do this without the certificate. As I want to build this thing into a app that we deploy at customers and I want to make it easily deployable as possible.

0 Likes
hvdbunte
Partner - Contributor III
Partner - Contributor III

Hi,

Thanks for this tutorial. I tried to connect with both Sense Feb/June 2018 and with both versions I can make a connection to the REST API if I click test connection. But when I try to select data, and I change from CSV to JSON I get this error:

Error.JPG

Any idea how to solve this?

I already tried to put accept application/json in as a parameter, as suggested in this post: Can't access the api with header "Content-Type"

But that didn't solve the issue.

Error2.JPG

What I would like to do is get a complete list of all apps in a specific stream.

Any help would be highly apricated. because I am new to all of this.

Thanks

0 Likes
bramkn
Partner - Specialist
Partner - Specialist

Hi Hendri,

What you want to do is to use a GET not a POST command. With this you cannot use the content-type header. The document provided should give you the info needed. You can always change the default REST connection in the QMC.

Edit the data connection named "monitor_apps_REST_app" so you can access it. Then use this LIB connect to get your data.

This script is needed for your information:

LIB CONNECT TO 'monitor_apps_REST_app';

RestConnectorMasterTable:

SQL SELECT

"id" AS "id_u1",

"createdDate",

"modifiedDate",

"modifiedByUserName",

"name" AS "name_u1",

"appId",

"sourceAppId",

"targetAppId",

"publishTime",

"published",

"description",

"stream",

"fileSize",

"lastReloadTime",

"thumbnail",

"savedInProductVersion",

"migrationHash",

"dynamicColor",

"availabilityStatus",

"privileges" AS "privileges_u1",

"schemaPath",

"__KEY_root",

(SELECT

"id" AS "id_u0",

"name" AS "name_u0",

"privileges" AS "privileges_u0",

"__FK_stream"

FROM "stream" FK "__FK_stream")

FROM JSON (wrap on) "root" PK "__KEY_root";

[stream]:

LOAD [id_u0] AS [id_u0],

[name_u0] AS [name_u0],

[privileges_u0] AS [privileges_u0],

[__FK_stream] AS [__KEY_root]

RESIDENT RestConnectorMasterTable

WHERE NOT IsNull([__FK_stream]);

[root]:

LOAD [id_u1] AS [id_u1],

[createdDate] AS [createdDate],

[modifiedDate] AS [modifiedDate],

[modifiedByUserName] AS [modifiedByUserName],

[name_u1] AS [name_u1],

[appId] AS [appId],

[sourceAppId] AS [sourceAppId],

[targetAppId] AS [targetAppId],

[publishTime] AS [publishTime],

[published] AS [published],

[description] AS [description],

[stream] AS [stream],

[fileSize] AS [fileSize],

[lastReloadTime] AS [lastReloadTime],

[thumbnail] AS [thumbnail],

[savedInProductVersion] AS [savedInProductVersion],

[migrationHash] AS [migrationHash],

[dynamicColor] AS [dynamicColor],

[availabilityStatus] AS [availabilityStatus],

[privileges_u1] AS [privileges_u1],

[schemaPath] AS [schemaPath],

[__KEY_root] AS [__KEY_root]

RESIDENT RestConnectorMasterTable

WHERE NOT IsNull([__KEY_root]);

DROP TABLE RestConnectorMasterTable;

0 Likes
Anonymous
Not applicable

 Hi All,

 

Can anyone help me on how to get information from QRS REST API for all applications in all streams? I want to get app id, app name and reload time for all stream and currently I am getting it for "Everyone" stream only. Please find below data connection done at my end. Please help.

QRS API connection 1.PNGQRS API connection 2.PNG

0 Likes
Version history
Last update:
‎2016-12-28 04:22 PM
Updated by: