Get User Roles

Get all roles that are assigned to a user.

Operation Permissions

User login to Application Portal is not required.

Request Format

GET https://{apigw-address}/app-portal-service/v2.2/user/role/assignedList

Request Parameters (Header)

Name

Mandatory/Optional

Data Type

Description

orgId

Mandatory

String

The organization ID.

userId

Mandatory

String

The user ID.

locale

Optional

String

The language code. If unspecified, it is set to English by default.

  • en_US for English

  • zh_CN for Chinese

  • es_ES for Spanish

  • ja_JP for Japanese

Response Parameters

Name

Data Type

Description

data

Data Struct

The list of roles.

Data Struct

Name

Data Type

Description

roles

RoleDTO Struct List

The list of role structs.

RoleDTO Struct

Name

Data Type

Description

id

String

The role ID.

name

String

The role name.

Error Codes

Code

Description

31404

The user or organization does not exist.

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.2/user/role/assignedList?orgId={your_org_id}&userId={your_user_id}

method: GET

Return Sample

{
    "code":0,
    "data":{
        "roles":[
          {
            "id":"r133",
            "name":"name133"
          },
          {
            "id":"r134",
            "name":"name134"
          }
        ]
    },
    "message":""
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void getUserRolesTest() {
        UserRoleListRequest request=new UserRoleListRequest("your_org_id","your_user_id","your_locale");
        RoleListResponse response=Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(request,RoleListResponse.class);
        assertNotNull("response data should not be null", response.data);
    }
}