Skip to content

Get User through directory field filter

MarceauGuy edited this page Sep 23, 2019 · 2 revisions

Get User through directory field filter

You can only use as a filter the field with the option "Use field in search filter" checked.

Get Field Id

Directory field

The field Id of a directory field can be found in the directory field template -> Edit content -> Directory pattern.
It should look like : YYY[YY=YY]/YYY

Custom field

The field Id of a custom field can be found by using the search function in a user directory, and inspecting the request in the Console / Network.
Select the last request list, scroll to the bottom, and find the custom field Id.
It should look like : ZZZ-ZZZ-ZZZ-ZZZ-ZZZ : "searchValue"

The request

contentId = 'XXX'
directoryFieldId = 'YYY[YY=YY]/YYY'
customFieldId = 'ZZZ-ZZZ-ZZZ-ZZZ-ZZZ'
body = {
    "contentId":contentId,
    "profileCriteria":{directoryFieldId:"value",
                       customFieldId :"value"
    }
}
result = api.get_call("user", "directory", "list", body = body)