<?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 Error 400  - Bad Request for import api call in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Error-400-Bad-Request-for-import-api-call/m-p/1663800#M12100</link>
    <description>&lt;P&gt;I can't find the reason this command in powershell raise an error&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;$hdrs = @{}&lt;BR /&gt;$hdrs.Add("X-Qlik-xrfkey","1234567890123456")&lt;BR /&gt;$hdrs.Add("X-Qlik-User","UserDirectory=XXXXX;UserId=XXXXXXXXXXXXXX")&lt;/P&gt;&lt;P&gt;$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;/P&gt;&lt;P&gt;$Body = @{&lt;BR /&gt;filename="test_import.qvf"&lt;BR /&gt;} | ConvertTo-Json&lt;/P&gt;&lt;P&gt;$url = "&lt;A href="https://xxxxx.xxxxxx.xxx:4242/qrs/app/import?name=test_import&amp;amp;xrfkey=1234567890123456" target="_blank" rel="noopener nofollow noopener noreferrer"&gt;https://XXXXX.XXXXXX.XXX:4242/qrs/app/import?name=test_import&amp;amp;xrfkey=1234567890123456&lt;/A&gt;"&lt;BR /&gt;$response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs -Certificate $cert -Body $Body -ContentType 'application/json'&lt;BR /&gt;$response&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoke-RestMethod : The remote server returned an error: (400) Bad Request.&lt;BR /&gt;At line:15 char:13&lt;BR /&gt;+ $response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs - ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException&lt;BR /&gt;+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/P&gt;&lt;P&gt;PS: I can run other POST or Get command&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:38:20 GMT</pubDate>
    <dc:creator>parviz_asoodehfard</dc:creator>
    <dc:date>2024-11-16T03:38:20Z</dc:date>
    <item>
      <title>Error 400  - Bad Request for import api call</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Error-400-Bad-Request-for-import-api-call/m-p/1663800#M12100</link>
      <description>&lt;P&gt;I can't find the reason this command in powershell raise an error&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;$hdrs = @{}&lt;BR /&gt;$hdrs.Add("X-Qlik-xrfkey","1234567890123456")&lt;BR /&gt;$hdrs.Add("X-Qlik-User","UserDirectory=XXXXX;UserId=XXXXXXXXXXXXXX")&lt;/P&gt;&lt;P&gt;$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}&lt;/P&gt;&lt;P&gt;$Body = @{&lt;BR /&gt;filename="test_import.qvf"&lt;BR /&gt;} | ConvertTo-Json&lt;/P&gt;&lt;P&gt;$url = "&lt;A href="https://xxxxx.xxxxxx.xxx:4242/qrs/app/import?name=test_import&amp;amp;xrfkey=1234567890123456" target="_blank" rel="noopener nofollow noopener noreferrer"&gt;https://XXXXX.XXXXXX.XXX:4242/qrs/app/import?name=test_import&amp;amp;xrfkey=1234567890123456&lt;/A&gt;"&lt;BR /&gt;$response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs -Certificate $cert -Body $Body -ContentType 'application/json'&lt;BR /&gt;$response&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoke-RestMethod : The remote server returned an error: (400) Bad Request.&lt;BR /&gt;At line:15 char:13&lt;BR /&gt;+ $response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs - ...&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException&lt;BR /&gt;+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand&lt;/P&gt;&lt;P&gt;PS: I can run other POST or Get command&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:38:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Error-400-Bad-Request-for-import-api-call/m-p/1663800#M12100</guid>
      <dc:creator>parviz_asoodehfard</dc:creator>
      <dc:date>2024-11-16T03:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error 400  - Bad Request for import api call</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Error-400-Bad-Request-for-import-api-call/m-p/1663811#M12101</link>
      <description>&lt;P&gt;This works for me:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;$hdrs = @{}
$hdrs.Add("X-Qlik-Xrfkey","examplexrfkey123")
$hdrs.Add("X-Qlik-User", "UserDirectory=INTERNAL; UserId=sa_api")
$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}
$Data = Get-Content C:\ProgramData\Qlik\Sense\Host.cfg
$FQDN = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($($Data)))
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' 
Invoke-RestMethod -Uri "https://$($FQDN):4242/qrs/app/upload?keepData=true&amp;amp;name=Some+Name&amp;amp;xrfkey=examplexrfkey123" -Method Post  -Headers $hdrs -ContentType 'application/vnd.qlik.sense.app' -Certificate $cert -InFile 'C:\Temp\Random Data.qvf'&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 08 Jan 2020 18:58:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Error-400-Bad-Request-for-import-api-call/m-p/1663811#M12101</guid>
      <dc:creator>Levi_Turner</dc:creator>
      <dc:date>2020-01-08T18:58:13Z</dc:date>
    </item>
  </channel>
</rss>

