Get Assets by Organization¶
Get all the assets that a specified user can access under a specified organization.
Operation Permissions¶
User login to Application Portal is not required.
Prerequisites¶
The associated application has been purchased by the organization.
The associated application must have access permissions (authorized by the organization administrator) for the assets.
Request Format¶
POST https://{apigw-address}/app-portal-service/v2.0/user/asset/list
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 >> |
pagination |
Optional |
Pagination Request Struct |
Lists the paging requirements in a request. If not specified, the default pagination size is 1000 pages, starting from 0. For more details, see Pagination Request Struct |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Data Struct |
The pagination and list of the assets’ information. |
Data Struct¶
Name |
Data Type |
Description |
---|---|---|
pagination |
Pagination Struct |
The pagination information. |
assets |
Assets Struct |
The list of the assets’ information. |
Pagination Struct¶
Name |
Data Type |
Description |
---|---|---|
pageNo |
Integer |
The request pages. |
pageSize |
Integer |
The number of records in each page. |
totalElements |
Long |
The total number of records. |
Assets Struct¶
Name |
Data Type |
Description |
---|---|---|
id |
String |
The asset ID. |
name |
I18nString |
The asset’s name in its respective locale’s language. For more details on the structure and locales supported, see Internationalized name struct |
orgId |
String |
The organization ID which the asset belongs to. |
Samples¶
Request Sample¶
url: https://alpha-apim-cn4.eniot.io/app-portal-service/v2.0/user/asset/list
method: POST
requestBody:
{
"userId": "yourUserId",
"orgId": "yourOrgId",
"pagination": {
"pageNo": 0,
"pageSize": 1000,
"sorters": []
}
}
Response Sample¶
{
"code": 200,
"message": "",
"data": {
"pagination": {
"totalElements": 2,
"pageNo": 0,
"pageSize": 1000
},
"assets": [
{
"id": "2rVQ6zfF",
"name": {
"default": "wyf_asset_01",
"en_US": "wyf_asset_01"
}
},
{
"id": "Sx0faZHR",
"name": {
"default": "12345678901234567890123456789012345678901234567890",
"en_US": "12345678901234567890123456789012345678901234567890"
}
}
]
}
}
Java SDK Sample¶
public class AppPortalSdkTest{
@Test
public void getAssetsByOrganizationTest() {
UserAssetListRequest userAssetListRequest=new UserAssetListRequest("your_user_id","your_org_id");
UserAssetListResponse response=Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
.url("https://{apigw-address}").getResponse(userAssetListRequest,UserAssetListResponse.class);
assertNotNull("Response should not be null", response);
assertNotNull("Response data should not be null", response.data);
assertNotNull("Asset could not be null", response.data.assets);
assertNotNull("Asset name could not be null", response.data.assets.get(0).name);
}
}