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: 
gustavgager
Partner - Creator II
Partner - Creator II

Running POST request trough the proxy

Hi there.

Im currently writing a script to access some featuyres of the QlikSense repository API and im therefor using the REST API.

I have succsessfully baan able to run "GET" coammands trough the proxy by suppling a Password for the account running the script. However i cannot get POST commands to run. When i do, i get a message that say that i need to run a GET command befor running my POST. This is confirmed by the documentation https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositorySe.... The problem is that it doesnt work. I run my GET command i get some data from the API, and then u run the POST, but then i get standard HTML (the page that say I need to run a GET command first). So how to do it?

This is my code:

$key = "ABCDEFGHIJKLMNOP"

$password = "mypassword"

$taskid =  "taskid..."

$url = "http://senseserver/qrs/task/" & $taskid & "/start/"

$objHTTP = ObjCreate("Msxml2.XMLHTTP.6.0")

//GET request

$objHTTP.open("GET","http://senseserver/qrs/about/?Xrfkey=" & $key, False,@UserName,$password)

$objHTTP.setRequestHeader("X-Qlik-Xrfkey",$key)

$objHTTP.send()

ConsoleWrite("Sense API Output: " & $objHTTP.responseText & @CRLF)

//POST Request

$objHTTP.open($metod,$url & "?Xrfkey=" & $key, False,@UserName,$password)

ConsoleWrite($url & "?Xrfkey=" & $key & @CRLF)

$objHTTP.setRequestHeader("X-Qlik-Xrfkey",$key)

$objHTTP.send()

$data = $objHTTP.responseText

ConsoleWrite("Sense API Output: " & $objHTTP.responseText & @CRLF)

The first GET request works fine. The POST, fails.

If i run the same URLs using POSTMAN (a Chrome-plugin REST client). Post works directly without any issues.

0 Replies