Get Structure Asset

Get all the assets that the user can access under an organization structure.

Request Format

POST https://{apigw-address}/app-portal-service/v2.2/structure/asset/list

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
structureIds Mandatory List<String> The list of organization structure IDs. Get the required organization structures by using the Get User Structures API.
locale Optional java.util.Locale The language used to display the asset name and organization structure name. By default, it is set to English.

Response Parameters

Name Data Type Description
data List<StructureAssetDTO> The assets that the organization structure and its users can access.

StructureAssetDTO Struct

Name Data Type Description
structureId String The organization structure ID.
structureName String The organization structure name.
assets List<AssetBaseDTO> The assets that the user can access under the organization structure.

AssetBaseDTO Struct

Name Data Type Description
assetId String The asset ID.
assetName String The asset name.

Error Codes

Code Description
31400 The structureIds are empty or invalid.
31401 The access token is invalid.
31404 The application used does not exist in the organization.

Samples

Request Sample

url: https://{apigw-address}/app-portal-service/v2.2/structure/asset/list

method: POST

headers: {"Authorization":"Bearer APP_PORTAL_S_TDKKeqfYBK3m5z3LRgKVqThWDYnRBN44"}

Return Sample

{
  "code": 0,
  "data": [
      {
        "children": [
                      {"assetId": "3rV4rzfF","assetName": "Inverter1"},
                      {"assetId": "2rVQ6ze4","assetName": "Inverter2"}
                    ],
        "structureId": "sg15941063016501",
        "structureName": "OrganizationA"
      },
      {
        "children": [
                      {"assetId": "2rd66fd3","assetName": "Inverter3"},
                      {"assetId": "2rVQ6zfF","assetName": "Inverter4"}
                    ],
        "structureId": "sg15941063016711",
        "structureName": "SOHO"
      }
    ],
  "message": ""
}

Java SDK Sample

public class AppPortalSdkTest{
    @Test
    public void getStructureAssetTest() {
        List<String> structureIds = new ArrayList<>();
        structureIds.add("your_structure_id1");
        structureIds.add("your_structure_id1");
        GetStructuresAssetsRequest getStructuresAssetsRequest = new GetStructuresAssetsRequest("your_access_token", structureIds, Locale.ENGLISH);
        StructureAssetsListResponse structureAssetsListResponse = Poseidon.config(PConfig.init().appKey("your_access_key").appSecret("your_secret_key").debug())
                .url("https://{apigw-address}").getResponse(getStructuresAssetsRequest, StructureAssetsListResponse.class);

        System.out.println("Structure Asset res: " + JSON.toJSONString(getStructuresAssetsRequest));

        assertNotNull("Response should not be null", getStructuresAssetsRequest);
        assertNotNull("Response data should not be null", getStructuresAssetsRequest.data);
    }

}