Get App Menu and Permission

Get the list of application menus and permissions.

Prerequisites

  • The associated application has been purchased by the organization.
  • The user must have access permission for the application’s menus and permissions (otherwise the response result is empty).

Request Format

GET https://{apigw-address}/app-portal-service/v2.1/user/app/resource/info

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
accessKey Query Mandatory String The service account of the application. The application authenticates with accessKey to obtain the data that it is authorized to access. How to get accessKey>>

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 application menus and permissions.

Data Struct

Name Data Type Description
permissions Array of Permission Structs The list of permissions.
menus Array of Menu Structs The list of menus.

Permission Struct

Name Data Type Description
id String The permission ID.
identifier String The permission identifier.
name String The permission name.

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.1/user/app/resource/info?accessKey=app_1
method: GET
requestHeader:
{
  "Authorization":"yourBearerToken"
}

Return Sample

{
  "code": 200,
  "message": "",
  "data": {
    "permissions": [],
    "menus": [
      {
        "id": "accessKey",
        "identifier": "menu",
        "name": "menu",
        "url": "/a",
        "displayOrder": 1,
        "parentId": "",
        "children": []
      },
      {
        "id": "accessKey",
        "identifier": "menu2",
        "name": "menu2",
        "url": "/eos-wind-map/assetOverview.html",
        "displayOrder": 2,
        "parentId": "",
        "children": []
      }
    ]
  }
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void GetAppMenuAndPermissionTest() {
        AppResourceRequest appResourceRequest = new AppResourceRequest("your_access_key", "your_access_token");
        AppResourceResponse appResourceResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(appResourceRequest, AppResourceResponse.class);

        System.out.println("Get app permission and menu res: " + JSON.toJSONString(appResourceResponse));

        assertNotNull("Response should not be null", appResourceResponse);
        assertNotNull("Response data should not be null", appResourceResponse.data);
        assertNotNull("Menus should not be null", appResourceResponse.data.menus);
        assertNotNull("Permissions should not be null", appResourceResponse.data.permissions);
    }
}