Get Users Role List

Get the roles of users without logging in to Application Portal.

Operation Permissions

In Application Portal, the application must be granted the “Obtain all user permissions in the OU” permission.

Request Format

POST https://{apigw-address}/app-portal-service/v2.2/userRoles/roleList

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
organizationId Mandatory String The organization ID. How to get organizationId>>
userIds Mandatory List The list of user IDs.

Response Parameters

Name Data Type Description
data Data Struct The information about users and their corresponding roles.

Data Struct

Name Data Type Description
usersRoles UsersRoleListResponse Struct The information about users and their corresponding roles.

UsersRoleListResponse Struct

Name Data Type Description
usersUserRoles UsersUserRolesDTO Struct The information about users and their corresponding roles.
userRoles UsersRolesInfoDTO Struct The role information.

UsersUserRolesDTO Struct

Name Data Type Description
userId String The user ID.
roleIds List The list of role IDs.

UsersRolesInfoDTO Struct

Name Data Type Description
id String The role ID.
name String The role name.

Error Codes

Code Description
31400 Errors such as incorrect parameters, empty parameters, character limits exceeded, and so on.
31403 The application has not been granted the “Obtain all user permissions in the OU” permission.
31404 Organization not found.

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.2/userRoles/roleList

method: POST

requestBody:
{"organizationId":"yourOrgId","userIds": ["user1","user2","user3"]}

Return Sample

{
    "code": 0,
    "message": "OK",
    "data": {
        "usersUserRoles": [
            {
                "userId": "u15689477086181",
                "roleIds": [
                    "ro16112212750581",
                    "ro16137846668911052",
                    "ro16137849323541174",
                    "ro16137849519171485",
                    "ro16137849674081515"
                ]
            },
            {
                "userId": "u16137062654571994",
                "roleIds": []
            }
        ],
        "userRoles": [
            {
                "id": "ro16112212750581",
                "name": "messageProduce"
            },
            {
                "id": "ro16137846668911052",
                "name": "testRole"
            },
            {
                "id": "ro16137849323541174",
                "name": "Grupo de menús"
            },
            {
                "id": "ro16137849519171485",
                "name": "'メニューグループ' ユーザーには選択し"
            },
            {
                "id": "ro16137849674081515",
                "name": "中文角色"
            }
        ]
    }
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void getUsersRoleList() {
            ArrayList<String> userIds = new ArrayList<>();
            userIds.add("user1");
            userIds.add("user2");
            userIds.add("user3");
            UsersRoleListRequest usersRoleListRequest = new UsersRoleListRequest(userIds,"your_org_id");
            UsersRoleListResponse response = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                    .url("https://{apigw-address}").getResponse(usersRoleListRequest, UsersRoleListResponse.class);

            System.out.println("List organization res: " + JSON.toJSONString(response));
            assertNotNull("Response should not be null", response);
            assertNotNull("Response data should not be null", response.data);

    }
}