<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Qlik Sense rest connection returns error in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2108705#M12730</link>
    <description>&lt;P&gt;That is my conclusion as well when looking at your error. Your quotes are skewed hence you have a outer " " wrapper of the whole BODY together with sub " " within.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF you fix that then you will most likely fix your error.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2023 22:19:17 GMT</pubDate>
    <dc:creator>Vegar</dc:creator>
    <dc:date>2023-08-22T22:19:17Z</dc:date>
    <item>
      <title>Qlik Sense rest connection returns error</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2104945#M12605</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to retrieve some data via de REST connector in Qlik Sense.&lt;/P&gt;
&lt;P&gt;When I use the REST connector, I can retrieve the data. In this connection is also a hardcoded bearer token which should be retrieved for every connection. So I can't use this connector as I can't put a bearer token as variable in the connection.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="heij1421_0-1691764187435.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114160i3EF322D9BCCC680D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="heij1421_0-1691764187435.png" alt="heij1421_0-1691764187435.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So I don't want to use this connector because of the bearer token, but I want to make the connection within my script.&lt;/P&gt;
&lt;P&gt;The script is:&lt;/P&gt;
&lt;DIV&gt;LET vRequestBody ='{';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'"ReportId": 200052,';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'"Parameters":[';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'{';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'"Name":"START_DATE",';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'"Value":"01-01-2023"';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'}';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;']';&lt;/DIV&gt;
&lt;DIV&gt;Let vRequestBody = vRequestBody&amp;amp;'}';&lt;/DIV&gt;
&lt;DIV&gt;let vRequestBody = replace(vRequestBody,'"', chr(34));&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Unqualify *;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;//LIB CONNECT TO 'REST_FLEXRAPPORT_ORDERS (hosting_039885_0002)';&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;RestConnectorMasterTable:&lt;/DIV&gt;
&lt;DIV&gt;SQL SELECT&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; "ordernr.",&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; "factuurnr."&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;FROM JSON (wrap off) "report"&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;WITH CONNECTION (&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; URL "$(vBaseURL)FlexReport/Get",&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; HTTPHEADER "Content-Type" "application/json",&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; HTTPHEADER "Authorization" "Bearer $(vAccessTokenValue)"//,&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; BODY "$(vRequestBody)"&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; )&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;When I run the script, it returns this error:&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV class="edc_error"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="heij1421_3-1691764887307.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114163iA6A91336A0B9618C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="heij1421_3-1691764887307.png" alt="heij1421_3-1691764887307.png" /&gt;&lt;/span&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;So it seems it can not handle the date. In postman and in the qlik connector with the fixed bearer token the data can be retrieved. It is a POST request.&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;I also tried different date formats like "20230101" which returns this error:&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&lt;SPAN&gt;Connector reply error: Unexpected lexem 'RequestBody' at (9,5). Expected 'CloseBracket'. Check SELECT STATEMENT syntax with documentation.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&lt;SPAN&gt;and "01/01/2023" returns this error:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&lt;SPAN&gt;Connector reply error: Unknown substring, string, or value at (9,72): '/01/2023"}]}"'&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;How to solve this?&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="edc_error"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Aug 2023 14:45:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2104945#M12605</guid>
      <dc:creator>heij1421</dc:creator>
      <dc:date>2023-08-11T14:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense rest connection returns error</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2108402#M12728</link>
      <description>&lt;P&gt;I don't believe the date is your problem, more likely it is the quotation encapsulation. This line is probably your problem:&lt;/P&gt;
&lt;P&gt;BODY "$(vRequestBody)"&lt;/P&gt;
&lt;P&gt;It renders to &lt;FONT color="#339966"&gt;BODY "{"ReportId": 200052, "Para&lt;/FONT&gt; ...and so on. Observe the quotation marks, they don't add up. Try something like &lt;FONT color="#339966"&gt;BODY '$(vRequestBody)'&lt;/FONT&gt; or &lt;FONT color="#339966"&gt;BODY [$(vRequestBody)]&lt;/FONT&gt; instead, that might help. Or maybe the api you're calling can accept the body with single quotes instead, then you could alter the contents of vRequestBody to &lt;FONT color="#339966"&gt;{'ReportId': 20&lt;/FONT&gt;...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 11:49:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2108402#M12728</guid>
      <dc:creator>henrikalmen</dc:creator>
      <dc:date>2023-08-22T11:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense rest connection returns error</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2108705#M12730</link>
      <description>&lt;P&gt;That is my conclusion as well when looking at your error. Your quotes are skewed hence you have a outer " " wrapper of the whole BODY together with sub " " within.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF you fix that then you will most likely fix your error.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 22:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2108705#M12730</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2023-08-22T22:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense rest connection returns error</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2112320#M12769</link>
      <description>&lt;P&gt;The error was indeed due to the body.&lt;BR /&gt;When I changed the variable vRequestbody from&lt;BR /&gt;&lt;SPAN&gt;let vRequestBody = replace(vRequestBody,'"', chr(34));&lt;BR /&gt;&lt;/SPAN&gt;to&lt;BR /&gt;let vRequestBody = replace(vRequestBody,'"', chr(34)&amp;amp;chr(34));&lt;/P&gt;
&lt;P&gt;the error didn't occur anymore, as all double quotes are changed to double-double quotes.&lt;/P&gt;
&lt;P&gt;So&lt;/P&gt;
&lt;P&gt;LET vRequestBody ='{"ReportId": 200051,"Parameters":[{"Name":"START_DATE","Value":"01/01/2023"}]}';&lt;BR /&gt;Let vRequestBody = replace(vRequestBody,'"', chr(34)&amp;amp;chr(34));&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;LET vRequestBody ='{""ReportId"": 200051,""Parameters"":[{""Name"":""START_DATE"",""Value"":""01/01/2023""}]}';&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also make sure that you create a (dummy) POST connection before this script, so Qlik is expecting a post request. I used the new REST api connection to '&lt;A href="https://jsonplaceholder.typicode.com/posts'" target="_blank"&gt;https://jsonplaceholder.typicode.com/posts'&lt;/A&gt;&amp;nbsp;with method POST as a dummy.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 13:31:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Qlik-Sense-rest-connection-returns-error/m-p/2112320#M12769</guid>
      <dc:creator>heij1421</dc:creator>
      <dc:date>2023-09-01T13:31:35Z</dc:date>
    </item>
  </channel>
</rss>

