Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.
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:
https://<server name>:4242/qrs/user/full?Xrfkey=0000000000000000&filter=removedExternally eq false
What do I need to add to the call to find all users which have a 'Client1' value in AvailableStreams?
It seems like it will be a customProperties filter, but I have no idea what the syntax should be.
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.
Did you find the answer to your last question?
I am wanting to filter the response based on some attributes, but dont know how to "group" the filters together.
/qrs/user/full?filter=attributes.attributeValue eq 'value1' would work, except if another attribute also had a value of value1, then is would cause unexpected matches
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:
The syntax will then be displayed in the Headers pane on the right. Below is an example:
I hope this helps.
Hi @Levi_Turner ,
What filter we can use to /qrs/user endpoint to get the list of users with blank Custom Property?
@babitaku : I am not aware of filtering on null. So you'd want to get all possible values then arrange a filter with them. Example: GET /qrs/user/full?filter=@Country ne 'USA' and @Country ne 'Finland'