MindSphere: update existing asset type

46 Views Asked by At

I have an asset and an assettype. Now, I want to expand the asset type. How can I do that. I work with the Java 1.0 SDK.

I tried the following but I always get an Exception (400 response code)

AssetTypeDto dto = new AssetTypeDto();
        Integer etag = assetTypeClient.getAssetTypeById("mytype").getEtag();
        System.out.println(etag);

        AspectTypeClient aspectTypeClient = AspectTypeClient.builder().mindsphereCredentials(credentials)
                .restClientConfig(config).build();

        AspectTypeResource atr = aspecttypeClient.getAspectTypeById("mynewType");

        dto.addAspectsItem(atr);

        assetTypeResource = assetTypeClient.updateAssetType("mytype", dto,etag + "");
1

There are 1 best solutions below

1
On

What does the error response say? Quick solution: Just update the assettype in Asset Manager via UI.