Search API - Workflow HTTP Request Action

Hi All,

Could someone please help me with below search queries using the search API in the HTTP Request action of the workflow?

  1. Search API call (POST) that should only return the requested access profiles (id, name) of a specific identity

  2. Search API call (POST) that should only return the requested access profiles (id, name) of those identities whose job title has "Test User’ in it.

I have tried the search query below but it returns all access including entitlements, roles and access profiles.

{
    "indices": [
        "identities"
    ],
    "query": {
        "query": "attributes.title: \"Test User\""
        
    },
    "queryResultFilter": {
        "includes": [
             
             "displayName",
             "id",
             "access"
                 ]
}
}

Thanks

Hey @nhassan how are you?

You can use innerhit on the Access Array inside the identities , in order to define your querys, ex:

{
    "indices": [
        "identities"
            ],
    "query": {        
    "query": "department==\"testDepartment\"",
    "innerHit": {
            "query": "_type:role",
            "type": "access"
        }
        
    },    
    "includeNested": true ,
    "queryResultFilter": {
        "includes": [
            "id",
"displayName"
            
        ]
    }
    

}

Let me know if this helps

4 Likes

Hi @ipobeidi I am doing well, thanks. Hope you are well too.

You JSON code slightly worked (as now it returns only roles) but not fully (as it returns both dynamic and requestable roles) of the identities instead of only requested roles. I’ve tried the JSON below but still it doesn’t return only requested roles.

{
    "indices": [
        "identities"
            ],
    "query": {        
    "query": "attributes.title: \"Test User\"",
    "innerHit": {
            "query": "type:ROLE",
            "type": "access",
           "requestable": "true"
        }
        
    },    
    "includeNested": true ,
    "queryResultFilter": {
        "includes": [
            "id",
            "displayName"            
            
        ]
    }
}

Another small thing I want to add is to return id and displayName of the identities along with their requested roles.

Thanks

@nhassan , gald that worked, however if you want to query on more thing , you need to include inside the “query” object, so if you want the requestetable, that would be :

...
 "query": "type:ROLE AND requestable:true",
.....

Best!

1 Like

@ipobeidi Thanks for the update.

  1. “requestable:true” worked fine but I found below differences in the real value when making API call to the two different endpoints i.e.
  • If I use search endpoint (POST) then I get ‘false’ value for all access (roles/access profiles) which is not correct. It means even if the roles/access profiles are requestable, still it returns false value.

  • But, if I use v3 or beta List Roles endpoint (GET), then I get the desired (actual) value of roles/access profiles.

In my case, I need to use search API to return the requestable roles or access profiles but as I said, it doesn’t return the correct value. Any thoughts on this?

  1. How should I amend the JSON to also returns id and displayName of the identities along with their requested roles?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.