Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Highlighted
Not applicable

Publish app with QRS API gives XSRF error

Hello,

I tried to write a simple .NET method to publish an existing app to a stream. The path that I used with QRS API is as below:

qrs/app/ee227e84-a2b0-4ba7-b9ec-9fe3d1718308/publish?stream=6f287d6f-3e6f-4a5e-9857-3d800e99da28?xrfkey=0123456789abcdef

However, it keeps giving me XSRF error ("XSRF prevention check failed. Possible XSRF discovered.") no matter I tested with Postman or from my own code, both of which I included the Header "X-Qlik-Xrfkey" with the same value 0123456789abcdef

I have a lot of other Qs API calls that used the same testing mechanism, but they all passed.

Is there anything wrong with my query above?

Thanks a lot!

Mengyi

Tags (2)
1 Solution

Accepted Solutions
Not applicable

Re: Publish app with QRS API gives XSRF error

Indeed, there is one typo that causes this failure.

You use two times the ? question mark. The second should become an &, right?:

qrs/app/ee227e84-a2b0-4ba7-b9ec-9fe3d1718308/publish?stream=6f287d6f-3e6f-4a5e-9857-3d800e99da28&xrfkey=0123456789abcdef

Cheers,

Thomas

5 Replies
Not applicable

Re: Publish app with QRS API gives XSRF error

Indeed, there is one typo that causes this failure.

You use two times the ? question mark. The second should become an &, right?:

qrs/app/ee227e84-a2b0-4ba7-b9ec-9fe3d1718308/publish?stream=6f287d6f-3e6f-4a5e-9857-3d800e99da28&xrfkey=0123456789abcdef

Cheers,

Thomas

Not applicable

Re: Publish app with QRS API gives XSRF error

Hi Friebel,

Thanks a lot for your help! It is working perfectly.

I used 2 question marks because the reference here used a question mark before "stream".

Please bear with me if this is a silly question, but it has been on my mind for a while.

When shall I use question mark and when shall I use & sign in a query?

Thanks again!

Mengyi

Not applicable

Re: Publish app with QRS API gives XSRF error

The query is separated by the ? from the path. Inside a query can be numerous key=value-pairs which are separated by &. That's basically it.

I strongly suggest you take some time to get deeper into the HTTP-thing as you will have to deal with it more often when using the REST apis. Maybe start here: http://code.tutsplus.com/tutorials/http-the-protocol-every-web-developer-must-know-part-1--net-31177

Cheers

Thomas

Not applicable

Re: Publish app with QRS API gives XSRF error

Thank you Thomas (sorry for getting the name wrong last time). It really helps a great deal!

oknotsen
Honored Contributor III

Re: Publish app with QRS API gives XSRF error

If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post) and Helpful Answers (found under the Actions menu under every post).

If not, please make clear what part of this topic you still need help with .

May you live in interesting times!