Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Skip the ticket, Chat with Qlik Support instead for instant assistance.
cancel
Showing results for 
Search instead for 
Did you mean: 
ryanplkam
Partner - Contributor III
Partner - Contributor III

400 bad request when using Qlik-CLI

Hello all,

I am trying to query for all users with a custom attribute called "professional" = true, using Qlik-CLI 

I am able to connect successfully, using certificates. 

The command is as follows:

 

get-qlikuser -filter "professional eq true" -full

 

This produces the following error message:

Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At C:\Program Files\WindowsPowerShell\Modules\Qlik-Cli\1.19.1\functions\core.ps1:63 char:19
+ $result = Invoke-RestMethod @paramInvokeRestMethod @params
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMetho
d], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCo
mmand

 

Any ideas what I'm doing wrong?

@Levi_Turner 

 

Thank you!

2 Solutions

Accepted Solutions
Levi_Turner
Employee
Employee

You're trying to filter on a custom property named professional, yes? If so then this would be the syntax:

Get-QlikUser -full -filter "@professional eq 'true'"

If not, then what is this attribute? A user attribute like a group? Something else?

View solution in original post

ryanplkam
Partner - Contributor III
Partner - Contributor III
Author

@Levi_Turner I figured it out, this is what I needed.

$professionalattributeusers = Get-QlikUser -full -filter "attributes.attributeType eq 'professional' and attributes.attributeValue eq 'true'"
Write-Output $professionalattributeusers

Thanks!

View solution in original post

3 Replies
Levi_Turner
Employee
Employee

You're trying to filter on a custom property named professional, yes? If so then this would be the syntax:

Get-QlikUser -full -filter "@professional eq 'true'"

If not, then what is this attribute? A user attribute like a group? Something else?

ryanplkam
Partner - Contributor III
Partner - Contributor III
Author

@Levi_Turner it is an attribute we've pulled in through SQL ODBC connector, like 'email' in this example

https://help.qlik.com/en-US/sense/June2019/Subsystems/ManagementConsole/Content/Sense_QMC/ODBC-examp...

 

Running your code does not produce an error, so I assume it's working. However when I try to view the result nothing appears:

 

$professionalattributeusers = Get-QlikUser -full -filter "@professional eq 'true'"
Write-Output $professionalattributeusers

 

Even though in QMC, I can see two users with this attribute = true.

Not sure if i'm still doing something wrong..

ryanplkam
Partner - Contributor III
Partner - Contributor III
Author

@Levi_Turner I figured it out, this is what I needed.

$professionalattributeusers = Get-QlikUser -full -filter "attributes.attributeType eq 'professional' and attributes.attributeValue eq 'true'"
Write-Output $professionalattributeusers

Thanks!