RoleSearch resource (Data API 23.2)

Summary

Http Method Resource Description
POST /role_search Searches for access roles.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

  • id - String
  • description - String

Optionally, a user ID (the user login) can be specified. When it is supplied, the search for roles is limited to the roles assigned to this user. When expanding the permissions for the roles, all effective permissions for this user can be retrieved.

Optionally, a (single) permission can be specified. When it is supplied, the search for roles is limited to the roles having this permission. When expanding the users for the roles, all users having this permission can be retrieved.

The output of the query can also be sorted. These are the list of sortable attributes:

  • id - String
  • description - String

Search public Access Roles

Searches for access roles.

The query attribute specifies a complex query that can be used to narrow down the search. These are the list of searchable attributes:

  • id - String
  • description - String

Optionally, a user ID (the user login) can be specified. When it is supplied, the search for roles is limited to the roles assigned to this user. When expanding the permissions for the roles, all effective permissions for this user can be retrieved.

Optionally, a (single) permission can be specified. When it is supplied, the search for roles is limited to the roles having this permission. When expanding the users for the roles, all users having this permission can be retrieved.

The output of the query can also be sorted. These are the list of sortable attributes:

  • id - String
  • description - String

Url

POST https://hostname:port/dw/data/v23_2/role_search

Formats

json, xml

Authentication

Name Description
OAuth Authentication via OAuth token.

Request Document

RoleSearchRequest

Response Document

RoleSearchResult

In case of a failure Fault Document is returned.

Faults

Status Type Arguments Description
400 MalformedSearchParameterException   Thrown if the query is ill-formed.
400 InvalidSearchQueryException

fault (String)

Throws when one of the search request restrictions is violated

Sample

REQUEST:
POST /s/-/dw/data/v23_2/role_search HTTP/1.1
Host: example.com
Authorization: Bearer b6104653-d53c-4175-a23d-52f118732ed5
Accept: application/json

{
    {
        "query": {
            "text_query": {
                "fields": [
                    "id"
                ],
                "search_phrase": "Manager"
            }
        },
        "user_id" : "admin",
        "select": "(**)",
        "sorts": [
            {
                "field": "id",
                "sort_order": "asc"
            }
        ],
        "expand": [
                "users"
        ]
    }
}

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 23170
Content-Type: application/json; charset=UTF-8

{
    "_v" : "23.2",
    "_type": "role_search_result",
    "count": 7,
    "expand": [
        "users"
    ],
    "hits": [
        {
            "_type": "role",
            "_resource_state": "d2581c7d113cff31342d782012f304175ba5333ad48617f5c3f72a12c27ba474",
            "description": "Allowed to manage locales",
            "id": "LocaleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/LocaleManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "LocaleDude",
                    "locked": false,
                    "login": "localeDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "49821f548f36454ca11c0dedc4a69ca1e0863bd37415055e2da40ff7e2423424",
            "description": "Allowed to manage things global",
            "id": "OrgManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/OrgManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "OrgDude",
                    "locked": false,
                    "login": "orgDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "9ebc0644131de366b60e29c9f9dfc2b6a1019d3969bb5ca8f7060f42feca340a",
            "description": "Allowed to manage roles",
            "id": "RoleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/RoleManager",
            "user_count": 2,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "RoleDude",
                    "locked": false,
                    "login": "roleDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SecondRoleManager",
                    "locked": false,
                    "login": "secondRoleManager",
                    "preferred_data_locale": "en",
                    "preferred_uilocale": "de"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "1bce5ab4efa425510f14d6e6f85d04060b6843a71567137fc819573d44538fcc",
            "description": "Allowed to manage only site SiteGenesis-DE",
            "id": "SiteGenesisDEManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/SiteGenesisDEManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisDEDude",
                    "locked": false,
                    "login": "SiteGenesisDEDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "4553edb0fa1ea413fa9646bb376182c8eeb721f47e7a41823691ea3d598f2159",
            "description": "Allowed to manage only site SiteGenesis",
            "id": "SiteGenesisManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/SiteGenesisManager",
            "user_count": 4,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisAgentMultiRole",
                    "locked": false,
                    "login": "SiteGenesisAgentMultiRole",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisOAuth2",
                    "locked": false,
                    "login": "SiteGenesisOAuth2",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "SiteGenesisDude",
                    "locked": false,
                    "login": "SiteGenesisDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisOAuth",
                    "locked": false,
                    "login": "SiteGenesisOAuth",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "896cbc90eeb44a199f85b3fba984639f73ab4d568c6ab838e6c712a00d7d30b5",
            "description": "Allowed to manage users",
            "id": "UserManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/UserManager",
            "user_count": 1,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "UserDude",
                    "locked": false,
                    "login": "userDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "025c8cff1b2a5b5ffac36e66e6644d368ceea61f6bcd6e807e37f4c16c8e07ad",
            "description": "Allowed to manage users and roles",
            "id": "UserRoleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/UserRoleManager",
            "user_count": 1,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "UserRoleDude",
                    "locked": false,
                    "login": "userRoleDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        }
    ],
    "query": {
        "text_query": {
            "_type": "text_query",
            "fields": [
                "id"
            ],
            "search_phrase": "Manager"
        }
    },
    "select": "(**)",
    "sorts": [
        {
            "_type": "sort",
            "field": "id",
            "sort_order": "asc"
        }
    ],
    "start": 0,
    "total": 7
}

REQUEST:
POST /s/-/dw/data/v23_2/role_search HTTP/1.1
Host: example.com
Authorization: Bearer b6104653-d53c-4175-a23d-52f118732ed5
Accept: application/json

{
    {
        "query": {
            "text_query": {
                "fields": [
                    "id"
                ],
                "search_phrase": "Manager"
            }
        },
        "permissions" :
        {
            "_type": "role_permissions",
            "module": {
                "_type": "role_module_permissions",
                "organization":
                [
                    {
                        "_type": "role_module_permission",
                        "application": "bm",
                        "system": true,
                        "type": "module",
                        "name":"a_module"
                    }
                ]
            }
        }
        "select": "(**)",
        "sorts": [
            {
                "field": "id",
                "sort_order": "asc"
            }
        ],
        "expand": [
                "users"
        ]
    }
}

RESPONSE:
HTTP/1.1 200 OK
Content-Length: 23170
Content-Type: application/json; charset=UTF-8

{
    "_v" : "23.2",
    "_type": "role_search_result",
    "count": 7,
    "expand": [
        "users"
    ],
    "hits": [
        {
            "_type": "role",
            "_resource_state": "d2581c7d113cff31342d782012f304175ba5333ad48617f5c3f72a12c27ba474",
            "description": "Allowed to manage locales",
            "id": "LocaleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/LocaleManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "LocaleDude",
                    "locked": false,
                    "login": "localeDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "49821f548f36454ca11c0dedc4a69ca1e0863bd37415055e2da40ff7e2423424",
            "description": "Allowed to manage things global",
            "id": "OrgManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/OrgManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "OrgDude",
                    "locked": false,
                    "login": "orgDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "9ebc0644131de366b60e29c9f9dfc2b6a1019d3969bb5ca8f7060f42feca340a",
            "description": "Allowed to manage roles",
            "id": "RoleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/RoleManager",
            "user_count": 2,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "RoleDude",
                    "locked": false,
                    "login": "roleDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SecondRoleManager",
                    "locked": false,
                    "login": "secondRoleManager",
                    "preferred_data_locale": "en",
                    "preferred_uilocale": "de"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "1bce5ab4efa425510f14d6e6f85d04060b6843a71567137fc819573d44538fcc",
            "description": "Allowed to manage only site SiteGenesis-DE",
            "id": "SiteGenesisDEManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/SiteGenesisDEManager",
            "user_count": 1,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisDEDude",
                    "locked": false,
                    "login": "SiteGenesisDEDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "4553edb0fa1ea413fa9646bb376182c8eeb721f47e7a41823691ea3d598f2159",
            "description": "Allowed to manage only site SiteGenesis",
            "id": "SiteGenesisManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/SiteGenesisManager",
            "user_count": 4,
            "user_manager": false,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisAgentMultiRole",
                    "locked": false,
                    "login": "SiteGenesisAgentMultiRole",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisOAuth2",
                    "locked": false,
                    "login": "SiteGenesisOAuth2",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "SiteGenesisDude",
                    "locked": false,
                    "login": "SiteGenesisDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                },
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "SiteGenesisOAuth",
                    "locked": false,
                    "login": "SiteGenesisOAuth",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "896cbc90eeb44a199f85b3fba984639f73ab4d568c6ab838e6c712a00d7d30b5",
            "description": "Allowed to manage users",
            "id": "UserManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/UserManager",
            "user_count": 1,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_login_date": "2017-01-11",
                    "last_name": "UserDude",
                    "locked": false,
                    "login": "userDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        },
        {
            "_type": "role",
            "_resource_state": "025c8cff1b2a5b5ffac36e66e6644d368ceea61f6bcd6e807e37f4c16c8e07ad",
            "description": "Allowed to manage users and roles",
            "id": "UserRoleManager",
            "link": "https://example.com/s/-/dw/data/v23_2/roles/UserRoleManager",
            "user_count": 1,
            "user_manager": true,
            "users": [
                {
                    "_type": "user",
                    "disabled": false,
                    "email": "[email protected]",
                    "first_name": "Ocapi",
                    "last_name": "UserRoleDude",
                    "locked": false,
                    "login": "userRoleDude",
                    "preferred_data_locale": "default",
                    "preferred_uilocale": "default"
                }
            ]
        }
    ],
    "query": {
        "text_query": {
            "_type": "text_query",
            "fields": [
                "id"
            ],
            "search_phrase": "Manager"
        }
    },
    "select": "(**)",
    "sorts": [
        {
            "_type": "sort",
            "field": "id",
            "sort_order": "asc"
        }
    ],
    "start": 0,
    "total": 7
}
X OCAPI versions 15.x and 16.x will be retired on March 31, 2021. For dates and more information, see the OCAPI versioning and deprecation policy and this Knowledge Article.