Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
brunnovb_in
Partner
Partner

Insert user with script in Qlik Sense app

Hello everyone!
I would like to know if you can enter a user in Qlik Sense through a Rest connection created? If so, could you share an example?

I have this demand on the client.

Thank you!

Best regards,

Labels (2)
1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

Use https://support.qlik.com/articles/000048247 as a reference point for creating the REST Data Connection to the QRS using certificates.

From there, here's a load script example for just user creation:

SET vCentralHostname = 'servername.domain.com';
SET vUserId = 'ExampleUser';
SET vUserDirectory = 'ExampleDir';

LIB CONNECT TO 'REST-QRS (Certificates) GET';

RestConnectorMasterTable:
SQL SELECT
"buildVersion"
FROM JSON (wrap on) "root"
WITH CONNECTION(
URL "https://$(vCentralHostname):4242/qrs/about",
QUERY "xrfkey" "abcdefg123456789",
HTTPHEADER "X-Qlik-Xrfkey" "abcdefg123456789",
HTTPHEADER "X-Qlik-User" "UserDirectory=$(vUserDirectory);UserId=$(vUserId)",
);

[root]:
LOAD [buildVersion]

RESIDENT RestConnectorMasterTable;

DROP TABLE RestConnectorMasterTable;

 

One key here is that you will need to ensure that the server defined in vCentralHostname matches the server name used to export the certificates.

The reason why using certificates is beneficial here is that we can then emulate any arbitrary user. 

View solution in original post

8 Replies
Mauritz_SA
Partner
Partner

Hi there

I had the same question and Levi Turner helped me in this post.

Hope it helps.

Regards,

Mauritz

brunnovb_in
Partner
Partner
Author

Hi Mauritz!
In your case, you did it using a call programmatically, for example, with JavaScript, right?
 
if you did using Qlik script in an app, could you share an example here? I need help with this question, using a app in Qlik Sense.
 
Regards,
Levi_Turner
Employee
Employee

So you want to create a user programmatically using a Qlik Sense app? Why? What's the use case here?

brunnovb_in
Partner
Partner
Author

Yes, I plan to create a user programmatically using a Qlik Sense application. The need comes from the customer. I know there are other ways, but I wonder if this is possible. In this client, he already inserts the user into NPrinting via API using REST in an application in Qlik Sense. And now the customer would like to enter users in the same way.

 

Thank you @Mauritz_SA @Levi_Turner 

Regards,

Levi_Turner
Employee
Employee

Use https://support.qlik.com/articles/000048247 as a reference point for creating the REST Data Connection to the QRS using certificates.

From there, here's a load script example for just user creation:

SET vCentralHostname = 'servername.domain.com';
SET vUserId = 'ExampleUser';
SET vUserDirectory = 'ExampleDir';

LIB CONNECT TO 'REST-QRS (Certificates) GET';

RestConnectorMasterTable:
SQL SELECT
"buildVersion"
FROM JSON (wrap on) "root"
WITH CONNECTION(
URL "https://$(vCentralHostname):4242/qrs/about",
QUERY "xrfkey" "abcdefg123456789",
HTTPHEADER "X-Qlik-Xrfkey" "abcdefg123456789",
HTTPHEADER "X-Qlik-User" "UserDirectory=$(vUserDirectory);UserId=$(vUserId)",
);

[root]:
LOAD [buildVersion]

RESIDENT RestConnectorMasterTable;

DROP TABLE RestConnectorMasterTable;

 

One key here is that you will need to ensure that the server defined in vCentralHostname matches the server name used to export the certificates.

The reason why using certificates is beneficial here is that we can then emulate any arbitrary user. 

View solution in original post

Mauritz_SA
Partner
Partner

Hi Levi

I stumbled onto the article you mentioned when I tried to find how you would integrate with QSE using third party applications. I decided to test the integration from my local PC following those steps, but I get the following error:

Cert Error.PNG

This is the same error we are getting from our 3rd party application which we want to integrate with Qlik Sense Enterprise. I exported the certificates using the steps in this article which is also referenced in the article you mentioned.

I have three questions:

1. How do I make sure that the IP address I issued the certificates to is correct? Can I just use "what is my ip" in Google to get my public IP address? When I use ipconfig in the command prompt I get a different IP when I am on WIFI and LAN.

2. How can I go about ensuring that the correct hostname is being used? This is in relation to your comment:

One key here is that you will need to ensure that the server defined in vCentralHostname matches the server name used to export the certificates.

We applied a GoDaddy wildcard certificate to our dev server so can I use the certified name which we use to access the QMC and Hub or should I get the name some other way?

3. Will this type of certificate integration work when integrating a third party application with QSE? We are building a cloud application which is supposed to integrate with many QSE servers and just want to know if it is the right way to go about it.

I'm sorry for hijacking this conversation, but I cannot find another thread that explains it nicely. As the POST request to create a user will need a working certificate I think the questions are relevant.

Regards,

Mauritz

 

Levi_Turner
Employee
Employee

These two values.

123523523.png

 

> We applied a GoDaddy wildcard certificate to our dev server so can I use the certified name which we use to access the QMC and Hub or should I get the name some other way?

Since we are going to the internal API ports, they will use the internal Qlik generated certificates, not any third party certificate bound to the Proxy Service.

Will this type of certificate integration work when integrating a third party application with QSE? We are building a cloud application which is supposed to integrate with many QSE servers and just want to know if it is the right way to go about it.

At a high-level, sure. At a practical level, the specific steps needed for a third party application really depend on that third party's capabilities and the peculiarities of the programming language present in that language. Since these internal certificates are not trusted by a third party, ensuring that you either ignore certificate validation or (preferred) include the root of the chain in the application to explicitly provide a chain of trust may be needed.

brunnovb_in
Partner
Partner
Author

Hi @Levi_Turner !

This is exactly what I needed to understand the parameters sent in SQL SELECT. I got solver!

Thank you very much!!!

 

Best regards,

Brunno V.B.