Authorize Asset

When a new asset on the EnOS platform is synchronized to the Application Portal, use this API to authorize the new asset to the asset creator.

Operation Permissions

User login to Application Portal is not required.

Prerequisite

The associated application must have access permissions (authorized by the organization administrator) for the user and asset information.

Request Format

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

Request Parameters (Body)

Name

Mandatory/Optional

Data Type

Description

userId

Mandatory

String

The user ID.

orgId

Mandatory

String

The organization ID which the asset belongs to. How to get orgId >>

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 = successful

  • false = unsuccessful

Samples

Request Sample

url: https://alpha-apim-cn4.eniot.io/app-portal-service/v2.0/user/asset/append
method: POST
requestBody:
{
  "userId": "yourUserId",
  "assetIds": [
    "H77kS15O"
  ],
  "orgId": "yourOrgId"
}

Return Sample

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

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void authorizeAssetTest() {
        AppendAssetsRequest appendAssetsRequest=new AppendAssetsRequest("your_user_id","your_org_id", Arrays.asList("your_asset_id"));
        Response response=Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(appendAssetsRequest,Response.class);
        assertNotNull("Response should not be null", response);
    }
}