0 Replies Latest reply: Jun 10, 2016 8:59 AM by Gustav Gager RSS

    Running POST request trough the proxy

    Gustav Gager

      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/RepositoryServiceAPI/RepositoryS…. 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:


      $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)
      ConsoleWrite("Sense API Output: " & $objHTTP.responseText & @CRLF)
      //POST Request
      $objHTTP.open($metod,$url & "?Xrfkey=" & $key, False,@UserName,$password)
      ConsoleWrite($url & "?Xrfkey=" & $key & @CRLF)
      $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.