Check Asset Permission

Check if the current user has the access permission for the queried asset.

Operation Permissions

User login to Application Portal is required.

Request Format

POST https://{apigw-address}/app-portal-service/v2.0/user/authorization/asset/check

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.

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

assetIds

Mandatory

String

The asset ID. Supports the query of multiple asset IDs, separated by commas. How to get assetId >>

Response Parameters

Name

Data Type

Description

data

Boolean

  • true = has access for all the queried assets

  • false = has no permission or has permission for only some of the queried assets

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.0/user/authorization/asset/check
method: POST
requestHeader: {"Authorization":"yourBearerToken"}
requestBody:{
  "assetIds": [
    "rJDyH3Rm",
    "FS6c3XAH",
    "qQHC4vyw",
    "txeiiU9x",
    "adNIljjB",
    "Dqp9GZsT",
    "Mk2BVzZN"
  ]
}

Return Sample

{
  "code": 200,
  "message": "",
  "data": false
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void checkAssetPermissionTest() {
        AssetPermissionCheckRequest assetPermissionCheckRequest = new AssetPermissionCheckRequest(Arrays.asList("your_asset_id"), "your_access_token");
        AssetPermissionCheckResponse assetPermissionCheckResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(assetPermissionCheckRequest, AssetPermissionCheckResponse.class);

        System.out.println("Check assetIds permission res: " + JSON.toJSONString(assetPermissionCheckResponse));

        assertNotNull("Response should not be null", assetPermissionCheckResponse);
        assertNotNull("Response data should not be null", assetPermissionCheckResponse.data);
        assertTrue("Should have permission", assetPermissionCheckResponse.data);
    }
}