Get Assets by Application


Get all the resources that the user can access under a specified application.

Prerequisites


  • The user has logged in to Application Portal and entered an OU. You can log in to Application Portal through the Log In API and select the OU through the Choose Organization API.

  • The OU has obtained the application, or the application is a self-built application in the OU.

  • The application has been granted the permission “Obtain all user permissions in the OU”. Contact the OU administrator to get the permission if necessary.

Request Format


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

Request Parameters (URI)


Name

Location (Path/Query)

Required/Optional

Data Type

Description

accessKey

Query

Required

String

The application’s accessKey, used for authentication to obtain the data that the application is authorized to access. How to obtain accessKey information >>

resourceTypes

Query

Optional

String

Specify resources by resource type, supporting up to 1000 types.

Request Parameters (Header)


Name

Required/Optional

Data Type

Description

Authorization

Required

String

The access token generated after the user logs in and selects the OU, represented by Bearer Token, is in the form of Bearer {your token}. You can call the Log In or Refresh Access Token API to obtain the access token.

needAssociatedAsset

Optional

Boolean

Whether to return the resource information mounted on the visible organization structure node. Supports the following values:

  • true means return.

  • false means do not return.

Default is false.

Response Parameters


Name

Data Type

Description

id

String

The resource ID or the organization structure node ID.

name

String

The default name of the resource.

tag

String

Resource tag.

  • If it is a resource, it returns asset.

  • If it is an organization structure node, it returns null.

Since resources can only be mounted on the end node of the organization structure, when this parameter returns asset, there must be a parent node, that is, it must return parentId, and the parent node is an organization structure node. At the same time, there must be no child nodes, that is, children is not returned.

tags

List<StructureTagDTO>

The tag of the organization structure node.

displayorder

Integer

The display order of organization structure nodes at the same level. The smaller the number, the higher the node is.

nameJson

I18nString

The resource name in multiple languages.

parentId

String

The parent node ID.

data.type

String

Resource Type ID. Returns only if the tag parameter returns asset. This value is null when the tag parameter returns null.

data.typeName

I18nString

Resource Type name. Returns only if the tag parameter returns asset. This value is null when the tag parameter returns null.

children

Data Struct

The child nodes.

associatedResources

Data Struct

The resource associated with the node.

StructureTagDTO Struct


Name

Data Type

Description

id

Integer

The serial number of organization structure tags. The smaller the serial number, the higher the tag.

key

String

The key of organization structure tags.

value

String

The value of organization structure tags.

Error Codes


Code

Description

31400

AccessKey is required

31401

Access Token is invalid

31403

No access to the application

31404

The application does not exist, or the organization does not obtain the application

31512

Selecting an OU is required

Samples

Request Sample


url: https://{apigw-address}/app-portal-service/v2.2/user/app/asset/tree?accessKey=your_access_key&resourceTypes=type1,type2

method: GET

headers: {"Authorization":"Bearer your_access_token"}

Return Sample


{
  "code": 0,
  "data": {
    "children": [
      {
        "children": [
          {
            "displayOrder": -1,
            "id": "your_asset_id",
            "name": "your_asset_name",
            "nameJson": {
              "default": "your_asset_name_default",
              "en_US": "your_asset_name_en",
              "zh_CN": "your_asset_name_zh",
              "es_ES": "your_asset_name_es",
              "ja_JP": "your_asset_name_jp"
            },
            "parentId": "",
            "tag": "asset",
            "type": "auth_unit",
            "typeName": {"default":"your_asset_type_default","en_US":"your_asset_type_en","zh_CN":"your_asset_type_zh"}}
          }
        ],
        "displayOrder": 0,
        "id": "your_asset_id",
        "name": "your_asset_name",
        "nameJson": {
          "default": "your_asset_name_default",
          "en_US": "your_asset_name_en",
          "zh_CN": "your_asset_name_zh"
        },
        "parentId": "your_node_id",
        "tags": [
          {
            "id": 123,
            "key": "your_tag_key",
            "value": "your_tag_value"
          }
        ]
      }
    ],
    "displayOrder": 0,
    "id": "your_asset_id",
    "name": "your_asset_name",
    "nameJson": {
      "default": "your_asset_name_default",
      "en_US": "your_asset_name_en",
      "zh_CN": "your_asset_name_zh"
    },
    "parentId": "",
    "tags": []
  },
  "message": "OK"
}