2 Replies Latest reply: Oct 24, 2017 5:05 AM by cristian ivanoff RSS

    Yet another REST connector problem!

    cristian ivanoff

      Hi All,

      First of all Im using QlikSense Business Cloud. I create a REST-connector with the POST method and it works fine. I see the desired results. The connection works. Then Im including the data from the connector through the icon "Choose data" and then "insert script". Here I also see the correct results. I see that it is receiving the correct results. BUT, when I load the app I get this error: "QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 400 (Bad Request): Bad Request"

       

      Why?

      Any suggestions how to move on from here?

       

      Br

      Cristian

        • Re: Yet another REST connector problem!
          cristian ivanoff

          These are the settings:

          Skärmavbild 2017-10-23 kl. 23.52.06.png

          Skärmavbild 2017-10-23 kl. 23.50.31.png

           

          Skärmavbild 2017-10-23 kl. 23.52.27.png

           

           

          The inserted script:

          LIB CONNECT TO 'GetNewToken';
          
          RestConnectorMasterTable:
          SQL SELECT 
          "col_1"
          FROM CSV (header off, delimiter ",", quote """") "CSV_source";
          
          [CSV_source]:
          LOAD [col_1] AS [col_1]
          RESIDENT RestConnectorMasterTable;
          DROP TABLE RestConnectorMasterTable;
          

           

          The error when loading:

           

          Skärmavbild 2017-10-23 kl. 23.55.06.png

            • Re: Yet another REST connector problem!
              cristian ivanoff

              ok. This doesnt work. But, I created another script. This is to get the latest token that I need to use in another connection:

               

              LIB CONNECT TO 'DummyPostConnection';
              SET vRequestBody = '{"username":"abcde","password":"abcde"}';
              
              let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));
              
              RestConnectorMasterTable:
              SQL SELECT
              "col_1"
              FROM CSV (header off, delimiter ",", quote """") "CSV_source"
              WITH CONNECTION ( 
                  URL "https://X/Login.ashx/", 
                  HTTPHEADER "Content-Type" "application/json", 
                BODY "$(vRequestBody)"
                ) 
              ; 
              [CSV_source]:
              LOAD [col_1] AS [col_1]
              RESIDENT RestConnectorMasterTable;
              DROP TABLE RestConnectorMasterTable;
              
              LET vToken = peek('col_1',0,'CSV_source');
              
              Drop table CSV_source;