Get Users UserGroup List

Get the user groups 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/userGroup/getUsersUserGroupList

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, supporting up to 1000 IDs.

Response Parameters

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

Data Struct

Name Data Type Description
usersUserGroups UsersUserGroupListResponse Struct The information about users and their corresponding user groups.

UsersUserGroupListResponse Struct

Name Data Type Description
usersUserGroups UsersUserGroupsDTO Struct The information about users and their corresponding user groups.
userGroups UserGroupInfoDTO Struct The user group information.

UsersUserGroupsDTO Struct

Name Data Type Description
userId String The user ID.
userGroupIds List The list of user group IDs.

UserGroupInfoDTO Struct

Name Data Type Description
id String The asset ID.
name String The user group 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/userGroup/getUsersUserGroupList

method: POST

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

Return Sample

{
  "code": 0,
  "message": "OK",
  "data": {
    "usersUserGroups": [
      {
        "userId": "u15689477086181",
        "userGroupIds": [
          "ug16112212947831",
          "ug16137850557861477",
          "ug16137850471151721",
          "ug16137850306771912",
          "ug16137849132031966"
        ]
      }
    ],
    "userGroups": [
      {
        "name": "messageProduce",
        "id": "ug16112212947831"
      },
      {
        "name": "Iniciando sesión",
        "id": "ug16137849132031966"
      },
      {
        "name": "Póngase en contacto@",
        "id": "ug16137850306771912"
      },
      {
        "name": "システムエラー。システム管理者に連絡して",
        "id": "ug16137850471151721"
      },
      {
        "name": "中文用户组",
        "id": "ug16137850557861477"
      }
    ]
  }
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void getUsersUserGroupList() {
            ArrayList<String> userIds = new ArrayList<>();
            userIds.add("user1");
            userIds.add("user2");
            userIds.add("user3");
            UsersUserGroupListRequest usersUserGroupListRequest = new UsersUserGroupListRequest(userIds,"your_org_id");
            UsersUserGroupListResponse response = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                    .url("https://{apigw-address}").getResponse(usersUserGroupListRequest, UsersUserGroupListResponse.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);

    }
}