Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Error 400 - Bad Request for import api call



I'm new in calling API, I can't find the reason this command in powershell raise an error

$hdrs = @{}

$cert = Get-ChildItem -Path "Cert:\CurrentUser\My" | Where {$_.Subject -like '*QlikClient*'}

$Body = @{
} | ConvertTo-Json

$url = "https://XXXXX.XXXXXX.XXX:4242/qrs/app/import?name=test_import&xrfkey=1234567890123456"
$response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs -Certificate $cert -Body $Body -ContentType 'application/json'




Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:15 char:13
+ $response = Invoke-RestMethod -Uri $url -Method POST -Headers $hdrs - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

PS: I can run other POST or Get command

Labels (2)
4 Replies
Creator III
Creator III

Before diving too deeply into this, why not just use Qlik-CLI? It's developed by Qlik and GREATLY improves usage and security of PowerShell and Qlik Sense. It will make your life so much easier when building a Qlik Sense & PowerShell ecosystem.
Creator III
Creator III

@parviz_asoodehfard  have you tried this?

Contributor III
Contributor III

The usage of power shell was a POC for me. After that, I need to run it by PDI and the base thing is enough for me, so I didn't try Qlik-CLI.


I found out I should use qrs/app/update.

I appreciate you @andoryuu 

Creator III
Creator III

Gotcha - glad it all worked out!