Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
Do you have an idea how to get the list of users in Qlik Sense using .Net SDK
Then change the custom properties of one selected user.
Thank you in advance.
Regards,
Mohamed
Hey,
You don't use the .NET SDK for that.
Instead we expose a REST based API for the Repository that you can query from your .Net application using RestSharp or something similar.
Documentation: http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositorySer...
The flow would be something like
HTTP GET /qrs/user
HTTP GET /qrs/user/<guid>
HTTP PUT /qrs/user/<guid> with a body that updates the properties you want to change and new modified timestamp
Hi! As Alexander Karlsson points out, this is not something the .Net SDK can help you with. The .Net SDK is used for accessing the engine API from .Net (documentation for the engine API can be found here: http://help.qlik.com/en-US/sense-developer/2.2/Subsystems/EngineAPI/Content/introducing-engine-API.h...). The engine API is primarily used to access and modify the information in apps.
Hi Alexander and Øystein,
Thank you for your response,
I am not familiar with .NET programming, I tried to create a program that aims to add a new user into Qlik Sense repository.
I faced this error: "Could not establish a trust relationship for the SSL/TLS secure channel"
I also created a virtual proxy using QlikSense 2x VirtualProxy Header Configuration and added it in the URL but same behavior.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://SERVERNAME/HEADER/QRS/user?xrfkey=" + xrfkey);
Can you advice please?
Thank you in advance.
Below the program code.
private void AddUser()
{
string xrfkey = "0123456789abcdef";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"https://SERVERNAME/QRS/user?xrfkey=" + xrfkey);
request.Method = "POST";
request.UserAgent = "Windows";
request.Accept = "application/json";
request.Headers.Add("X-Qlik-xrfkey", xrfkey);
// specify to run as the current Microsoft Windows user
request.UseDefaultCredentials = true;
//The body message sent to the Qlik Sense Proxy api will add the session to Qlik Sense for authentication
string user = "TESTQLIKSENSE";
string userdirectory = "DOMAIN";
string body = "{ {'userId':'" + user + "','userDirectory':'" + userdirectory + "','name'='" + user + "'";
// body += "'Attributes': [],";
body += "}";
byte[] bodyBytes = Encoding.UTF8.GetBytes(body);
if (!string.IsNullOrEmpty(body))
{
request.ContentType = "application/json";
request.ContentLength = bodyBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(bodyBytes, 0, bodyBytes.Length);
requestStream.Close();
}
// make the web request and return the content
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream stream = response.GetResponseStream();
Console.WriteLine(new StreamReader(stream).ReadToEnd());
}
Regards,
Mohamed
Out-of-the-box the Proxy in Qlik Sense Server uses a self-signed certificate. This is not trusted by normal clients, e.g. a browser will show a warning page. A workaround from a C# program is to add the following line of code before any call to the Sense server.
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
This will accept any signing party. A more elaborated version you could verify that the signing certificate actually is the one used by the Qlik Sense Server, or ask the owner of the Qlik Sense Server to install a trusted certificate.
@Alexander Karlsson .. why don't you use the SDK for that?
The .NET SDK manages Engine API interaction, such as in document assets, selection models and data.
Users, meta data, access rights etc are managed by the QRS and then accessed using the QRS API which is a standard REST api so no need for a SDK for that as the normal web client in .Net does the job perfectly.
@akl
But if you are already using the SDK, why introduce the API connection and get that authorization also in place.
I'm not sure if there are thing that the SDK can do which the API can't and the other way around.
Hi Alexander,
Can we use this REST APIs directly in the QlikSense Data Load Esitor of the apps ? Since in QlikSense we can use the REST APIs to get the information right ! So can we use this to get the data from the server ?
Have anybody tried out this option please let me know.
Thanks & Regards,
Santosh Kumar.