Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Qiyanlu66
Partner - Contributor III
Partner - Contributor III

How to use Proxy API in C#

Hello all,

I am currently working on the Qlik .net SDK and need to delete the Proxy session.

So my question is that how do I use the Proxy REST APIs in .net SDK?

Can some one please tell me how to do it or is there a link of step-by-step tutorial.

Thanks guys.

 

1 Solution

Accepted Solutions
Øystein_Kolsrud
Employee
Employee

I have this little project that might find useful. It's a light-weight SDK for establishing connections to the REST based Qlik Sense services:

https://github.com/kolsrud/qlik_rest_sdk

The dll is available for download from nuget:

https://www.nuget.org/packages/QlikSenseRestClient/

View solution in original post

6 Replies
Qiyanlu66
Partner - Contributor III
Partner - Contributor III
Author

So I believe in order to use the Proxy REST API to delete session, I have to Connecting to the QPS API in C# right?
I have look at the documentation for Connecting to the QPS API using certificates
(https://help.qlik.com/en-US/sense-developer/June2018/Subsystems/ProxyServiceAPI/Content/ProxyService...)
But I still have no idea where should I start.
Øystein_Kolsrud
Employee
Employee

I have this little project that might find useful. It's a light-weight SDK for establishing connections to the REST based Qlik Sense services:

https://github.com/kolsrud/qlik_rest_sdk

The dll is available for download from nuget:

https://www.nuget.org/packages/QlikSenseRestClient/

Qiyanlu66
Partner - Contributor III
Partner - Contributor III
Author

Thank you very much, the SDK works very well.
Can I ask you one more question about how to delete a Session .
In the Documentation, it has

Path
/qps/{virtual proxy/}session/{id}

Method
DELETE

Description
This deletes the proxy session identified by {id} and performs a teardown of all connections for that session. The Session module is notified. The deleted session is returned as a session struct.

So, for the path /qps/{virtual proxy/}session/{id}
What value should I put for the {virtual Proxy}, I checked the QMC, should I use the description of the central node, or the Perfix, or the Session cookie header name?

Thanks you for your help!
Øystein_Kolsrud
Employee
Employee

I'm not familiar with that endpoint, but I would guess that you are supposed to use the virtual proxy prefix (if there is any).

Qiyanlu66
Partner - Contributor III
Partner - Contributor III
Author

Hey, When I use the following code to send one API request, it seems I can only send on each time ?

var senseServerUrl = "https://100.00.0";
var restClient = new RestClient(senseServerUrl);
var certs = RestClient.LoadCertificateFromStore();
restClient.AsDirectConnection(4243, false, certs);
using (new Qlik.Sense.RestClient.DebugConsole())
{
restClient.Get("/qps/session");
restClient.Delete("/qps/session/18247d");
}

If there is only restClient.Get("/qps/session"); it works fine. But if there are two requests, it will return a error Authentication failed: 503: Service Unavailable

Do you knowhow should I fix it?

Thank you sir.
Øystein_Kolsrud
Employee
Employee

Where do you get that session id from? Isn't it simply the case that you are deleting the session you are using for your RestClient so that you get logged out and have to reauthenticate?