Get Organization List

List the organizations which the current user belongs to according to the access token.

Operation Permissions

User login to Application Portal is required.

Request Format

url: https://{apigw-address}/app-portal-service/v2.0/user/organization/list
method: GET

Request Parameters (Header)

Name

Mandatory/Optional

Data Type

Description

Authorization

Mandatory

String

The access token (or bearer token). Refer to Log In or Refresh Access Token to learn how to get the access token.

Response Parameters

Name

Data Type

Description

data

Data Struct

The list of the organizations.

Data Struct

Name

Data Type

Description

organizations

IdNamePair Struct

The details of the organizations.

IdNamePair Struct

Name

Data Type

Description

id

String

The organization ID.

name

String

The organization name.

Samples

Request Sample

GET
https://{apigw-address}/app-portal-service/v2.0/user/organization/list
headers: {"Authorization":"yourBearerToken"}

Return Sample

{
  "code": 200,
  "message": "",
  "data": {
    "organizations": [
      {
        "id": "yourOrgId_1",
        "name": "rm_0726_001"
      },
      {
        "id": "yourOrgId_2",
        "name": "Portal Demo"
      }
    ]
  }
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void getOrganizationListTest() {

        UserOrganizationListRequest userOrganizationListRequest = new UserOrganizationListRequest("your_access_token");
        UserOrganizationListResponse userOrganizationListResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(userOrganizationListRequest, UserOrganizationListResponse.class);

        System.out.println("List organization res: " + JSON.toJSONString(userOrganizationListResponse));

        assertNotNull("Response should not be null", userOrganizationListResponse);
        assertNotNull("Response data should not be null", userOrganizationListResponse.data);
        assertNotNull("Organizations should not be null", userOrganizationListResponse.data.organizations);
        assertThat("Organizations should not be empty", userOrganizationListResponse.data.organizations, not(IsEmptyCollection.empty()));
    }
}