Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Creating App with QlikSense Repository Service API (REST)

Hello everybody,

I'am trying to create an app by using the qrs api.

Therefore i have created a websocket in Dot.Net with wich i can receive all apps already.

However the creation of new apps failed. Does anybody know how i can fix this?

Here is my code:

                string xrfkey = "0123456789abcdef";

                string requestQuery = @"https://<server>/qrs?xrfkey="+xrfkey;

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestQuery);

                request.Method = "POST";

                request.UserAgent = "Windows";

                request.Accept = "application/json";

                request.UseDefaultCredentials = true;

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

               

                string body = @"{""jsonrpc"": ""2.0"",""id"": 0,""method"": ""CreateApp"",""handle"":

                -1,""params"": [""Test.qvf""]}";

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

                }

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

                Stream stream = response.GetResponseStream();

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

Exception:

     The remote server returned an error: (404) Not Found.

I think i have to use the qes API, but i don´t know how i can connect to. The documentation did not help me anymore.

Best Regards

Robert

1 Reply
rajeshvaswani77
Specialist III
Specialist III

Hi Robert,

Did you have any success with a POST method from .NET. I could make all the GETs to work.

POST always gives a Bad request. I tried for creating a new tag/ new stream.

Can you please confirm if you are able to create any of these, if yes what JSON was the correct one for the request body?

Thanks,

Rajesh Vaswani