Update Logical Asset


Update all or selected details of a logical asset.

Operation Permissions

Required Service Required Action Permission
Asset Tree Full Access

Prerequisite

  • The logical asset to be updated must exist.
  • The selected details to be updated must exist.

Request Format

POST https://{apigw-address}/asset-service/v2.1/logical-assets?action=update

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
orgId Query Mandatory String The organization ID which the asset belongs to. How to get orgId>>
isPatchUpdate Query Optional Boolean
  • true (default): Only the fields specified in the parameters are updated. The values of those fields not specified will be retained.
    • false: The fields specified in the parameters are updated. Those fields not specified will have their existing values (if any) deleted. Note that timezone and name need to be specified when isPatchUpdate is false.

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
assetUpdateVo Mandatory AssetUpdateVo Struct

Used for asset update.

  • When isPatchUpdate is true, only the fields specified in the parameters are updated. The values of those fields not specified will be retained.
  • When isPatchUpdate is false, the fields specified in the parameters are updated. Those fields not specified will have their existing values (if any) deleted.

For more information, see AssetUpdateVo Struct.

Error Codes

Code Message Description
17404 Logical asset does not exist The assetId cannot be found or does not exist.
17958 Asset validation failed Failed to verify assets based on model.

Samples

Request Sample

url: https://{apigw-address}/asset-service/v2.1/logical-asset?action=update&orgId=yourOrgId&isPatchUpdate=true
method: POST
requestBody:
{
    "assetUpdateVo":{
        "assetId":"yourAssetId",
        "name":{
            "defaultValue":"instanceName",
            "i18nValue":{
                "en_US":"English name ",
                "zh_CN":"Chinese name"
            }
        },
        "description":"description",
        "attributes":{
      "color": "blue",
      "number": 135
        },
        "timezone":"+08:00",
        "tags":{
            "year":"2000",
            "author":"authorName"
        }
    }
}

Return Sample

{
 "code": 0,
 "msg": "OK",
 "requestId": "fa11232e-7e45-4176-a382-963c1240a27f"
}

SDK Samples


You can access the SDK samples for Asset Service on GitHub: