Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello
I'm using the .NET SDK to connect to QlikSense server using certificate authentication, like this:
//Connect to QlikSense server
senseServerLocation.AsDirectConnection(
"myuserdir", //User directory
"administrator", //UserID (this user is RootAdmin)
false,
false,
x509collection //Certificate
);
all goes correctly, and I can manipulate apps and objects. However, later, I'm trying to export data from an object, like this:
var exportResult = table.ExportData(NxExportFileType.EXPORT_OOXML, @"/qHyperCubeDef", "out.xlsx", NxExportState.EXPORT_ALL);
var downloadUrl = "https://mysenseserver/" + exportRes.Url.ToString();
However, if I download the url using WebClient (or similar class) it just returns the QlikSense login page, since I'm not authenticated. But since I'm using certificate to authenticate, I don't have username/pass to authenticate properly. How do I download the exported file in this case??
I'm not sure if this will work, but I have this rather experimental project for connecting to the QRS:
https://github.com/kolsrud/qlik_rest_sdk
There you can configure a connection using an "AsDirectConnection" approach similar to the one used for the SDK:
https://github.com/kolsrud/qlik_rest_sdk/blob/master/Qlik.Sense.RestClient/RestClient.cs#L38
I've never tried if it works when you just want to download that URL, but if you're lucky, then it might at least give you some clues as to how it can be done.
Hi to all !!
After 2 years I have the same issue.
Connected with QlikSense using AsNtlmUserViaProxy method ....I can manage hypercubes data with no problem.
But ...when I try to export data from a GenericObject (a sheet's table) using WebClient (with certificate generated with QMC) "it just returns the QlikSense login page" as master_t said.
Any help ...please ?
master_t exports using the engine SDK. And then he downloads the export using the Rest SDK @Øystein_Kolsrud provided.
You can use the same form of authentication for both. So In your case you kan use Ntlm authentication method with the Rest, you don't need to use the certificate.
Thank you for your reply.
So...are you talking about the Qlik.Sense.RestClient ?
This is the test I made:
Dim Nc As New Net.NetworkCredential(<user>, <password>, <domain>)
Dim Rc As New RestClient(<server url>)
Rc.AsNtlmUserViaProxy(Nc, False)
If Rc.Authenticate Then
Txb.Text = Rc.Get("/qrs/about")
End If
Rc = Nothing
....then Txb (is a textbox) text property contais the html source of the image GetError.
Why ?
Thank you.
Sorry guys .....I forget to add the virtual proxy.
Instead of
Dim Rc As New RestClient(<server url>)
I have to use
Dim Rc As New RestClient(<server url>/<virtual proxy name>)
Now Rc.Get("/qrs/about") returns the right infos !!
Now I have the ExportDataResult of ExportData method ...and I suppose that I have to run a RestClient Get method: what's the parameters to use to dowload exported data into a file ?
Thank you again !!!
The latest version of the RestClient contains a method called "GetBytes" for downloading binary data. So try something like this:
var result = obj.ExportData(NxExportFileType.EXPORT_OOXML);
var data = client.GetBytes(result.Url);
File.WriteAllBytes("myfile.xlsx", data);
That's the reason why ....I don't have the latest one !!!
I downloaded some days ago the 1.2 release (for .Net)...it's not the latest one ...I suppose.
No, I uploaded that one earlier today 🙂 Fresh off the press!