Update Asset¶
Update asset information.
Action Permissions¶
Before invoking this API, ensure that the service account has been authorized the policy that includes the following service(s) and action permission(s). For how to authorize the service account, see Managing Service Accounts.
Required Service |
Required Action Permission |
---|---|
Asset Tree |
Full Access |
Prerequisite¶
The asset to be updated must exist.
The fields to be updated must exist.
Request Format¶
POST https://{apigw-address}/asset-service/v2.1/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>> |
(deprecated) isPatchUpdate |
Query |
Optional |
Boolean |
This parameter is deprecated. It is recommended to use
|
updateMode |
Query |
Optional |
String |
The update method. If both
|
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
asset |
Mandatory |
AssetUpdateVo Struct |
The details for updating the asset. For more information, see AssetUpdateVo Struct. |
AssetUpdateVo Struct ¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
assetId |
Mandatory |
String |
The asset ID. How to get assetId>> |
name |
Optional |
StringI18n |
Specify the asset’s name in its respective locale’s language. For more details on the structure and locales supported, see Internationalized name struct. |
description |
Optional |
String |
The asset description. |
attributes |
|
Map (Key is of String type, and Value depends on the attribute defined in the model) |
Attributes of the model which the asset belongs to. Key is the attribute ID. For more information, see attributes representation. |
timezone |
Optional |
String |
For details, see Timezone representation. |
tags |
Optional |
Map (Key and Value are of String type) |
User-defined tags. For more information, see How to use tag. |
tagKeys |
Only applicable when |
String Array |
The list of tags under the asset to be deleted, defined by their tag keys. |
Error Codes¶
Code |
Message |
Description |
---|---|---|
12404 |
Asset is not existent |
The |
12958 |
Asset validate failed |
Update failed due to asset attribute verification failure. |
Samples¶
Request Sample¶
url: https://{apigw-address}/asset-service/v2.1/assets?action=update&orgId=yourOrgId&updateMode=tagDelete
method: POST
requestBody:
{
"asset": {
"assetId": "yourAssetId",
"name": {
"defaultValue": "instanceName",
"i18nValue": {
"en_US": "English name ",
"zh_CN": "Chinese name"
}
},
"description": "description",
"attributes": {
"number": 135
},
"timezone": "+08:00",
"tags": {
"year": "2000",
"author": "authorName"
},
"tagKeys": ["book1","book2"]
}
}
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: