I have custom property which I can assign to a user called AvailableStreams. This is used to determine which users have access to which streams with a generic security rule. How can I get all the users who have not been removed externally with a certain AvailableStreams custom property value using an API?
I am able to get a list of users who are not removed externally using the following call:
PS: a user can have more than one AvailableStreams custom property value.
I would appreciate any help.
I got a partial solution just after posting the question.
https://<server name>:4242/qrs/user/full?Xrfkey=0000000000000000&filter=removedExternally eq false and customProperties.value eq 'Client1'.
However, with this I do not specify which Custom Property has to have a value equal to Client1. Is there a way that I can specify that the AvailableStreams custom property should be equal to 'Client1'? I am just scared that in future I will dig a hole for myself if I want to manage other privileges using custom properties which might have the same values (i.e. having 'Client1' as a value for another custom property in future).
Thanks, that's exactly what I wanted! I will mark it as a solution. Can you maybe give me the syntax for filtering on user attributes (for example and attribute called SomeAttribute) as well?
/qrs/user/full?filter= removedExternally eq false and (@AvailableStreams eq 'Client1' or SomeAttribute eq 'Client1')
After your previous message I assumed that custom properties have an @ before them and that attributes would not have anything (like in security rules), but I get a "Cannot convert the constant value: SomeAttribute" error in Postman.
Maybe I am searching incorrectly, but I was not able to find any examples of this. Is there a place which explains the syntax for using different Qlik 'elements' in API calls?
It seems like /qrs/user/full?filter= removedExternally eq false and (@AvailableStreams eq 'Client1' or attributes.attributeType eq 'SomeAttribute' and attributes.attributeValue eq 'Client1') works. If this way of doing it is correct, how does it know that the attributeType and attributeValue refer to the same attribute and need to be considered together? For example, would this call not also return a user with a SomeAttribute value of 'Client2' and a SomeOtherAttribute value of 'Client1'? Or are the attributeType and attributeValue conditions considered as a pair? The reason why I am asking is because qrs/user/full?filter= removedExternally eq false and (@AvailableStreams eq 'Client1' or attributes.attributeValue eq 'Client1') also works and I just want to make sure that I cover all my bases.
Re: Qrs get all users with a specific custom property
It seems as if the attributes.attributeType and attributes.attributeValue are considered as a pair. So you would first specify which attribute (attributes.attributeType) and then filter on a value (attributes.attributeValue). A really nice way of getting the syntax (I stumbled upon it) is to actually build your filter in the users screen in the QMC and then inspect the POST that is made. In Chrome, do the following with the QMC Users page open:
Customise and control Google Chrome (top right)
More Tools -> Developer Tools
Click on Network
Set up your filter in the QMC and then make the Search call
The syntax will then be displayed in the Headers pane on the right. Below is an example: