Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Tell us which business and trade publications you read most regularly: RESPOND NOW
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unable to get targetId from QPS ticket response

Based on blog:


I make the json request as:

  string body = "{ 'UserId':'" + user + "','UserDirectory':'" + userdirectory + "','Attributes': []," + " 'TargetId':'cd4805f4-e25f-436a-847e-8e82208fb1e0'}";

cd4805f4-e25f-436a-847e-8e82208fb1e0 being the app i want redirect to.

However the response is only:

{ "Userid: user", "UserDirectory: userdirectory" }

Why the targetid is not showing like in the blog example??

Also i would like to know where to get proxy urls ( ie. /hub) in the format like the appid in this example is.

6 Replies

First check out the documentation at https://help.qlik.com/sense/en-us/developer/ which has tons of great samples of the APIs.

How are you authenticating your requests? Are the certificates in place? XRF key injected into the header?

The QPS url would be https://<servername>:4243/qps/<virtual proxy if your are using one>/ticket?xrfkey=<XRF key which mat...

Check out this snippet which should give you some clues, https://gist.github.com/mindspank/4f93cac0c484cda3c500

Not applicable

I am authenticating with C# thus:

1. // get certificate

private X509Certificate2 certificate_ { get; set; }

public string TicketExampleCertificate()


            // First locate the Qlik Sense certificate

            X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);


            certificate_ = store.Certificates.Cast<X509Certificate2>().FirstOrDefault(c => c.FriendlyName == "QlikClient");


            ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };



2. // Get the Qlik ticket

public string TicketRequest2(string method, string server, string user, string userdirectory, string redirecturl)


            //Create URL to REST endpoint for tickets

            string url = "https://" + server + ":4243/qps/ticket";

            //Create the HTTP Request and add required headers and content in Xrfkey

            string Xrfkey = "0123456789abcdef";

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + "?Xrfkey=" + Xrfkey);

            // Add the method to authentication the user


            request.Method = method;

            request.Accept = "application/json";

            request.Headers.Add("X-Qlik-Xrfkey", Xrfkey);

            string body = "{ 'UserId':'" + user + "','UserDirectory':'" + userdirectory + "','Attributes': []," + " 'TargetId':' " + redirecturl + "'}";

            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);



            // make the web request and return the content



                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                Stream stream = response.GetResponseStream();

                return stream != null ? new StreamReader(stream).ReadToEnd() : string.Empty;


            catch (WebException ex)


                using (var stream = ex.Response.GetResponseStream())

                using (var reader = new StreamReader(stream))





                return "Error";



3. Reply:




Ye everything seems ok.

I was playing around with it this morning, only on MS8 though, and could not get a response out of the TargetUri regardless if I posted it through the body as a query parameter.

I have logged it with support, lets see what they say.

Not applicable

although it has been almost a year

I wonder what happen to this problem.

Partner - Contributor III
Partner - Contributor III

I'm had the same problem... Did you found a solution for this problem?

Contributor II
Contributor II

My colleague found the solution.

var jsonrequest = JSON.stringify({ 'UserDirectory': userdirectory.toString() , 'UserId': selecteduser.toString(), 'Attributes': [], 'TargetId':targetId });

This will get you a response from the TarketUri.