You can update the display name and unit of an attribute definition. If the requested attribute does not exist, then an error message is received in the response message. You can update multiple attribute definitions in a single request. You cannot update the predefined attribute definitions.
Request line
Post baseURL/dbapi.do?action=updateAttributeDef&dataset=<Datasetname>
Request body
[ { "id":"", "name":"" }, { "id":"", "name":"", "unit":"" } ]
Request example
POST /dbapi.do?action=updateAttributeDef&dataset=defaultDs HTTP /1.1 Authorization:Basic ZnJlZDpmcmVk
[ { "id":"numCores", "name":"Number Of Cpu" }, { "id":"cpuUsage", "name":"Cpu Usage", "unit":"Percent" } ]
Request parameters
Parameter | Type | Description |
---|---|---|
action | String | updateAttributeDef
Specify the API function to be invoked. |
dataset | String | Dataset name. From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. |
id | String | Attribute definition ID.
From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. |
name | String | (Optional) Attribute definition name.
From 2 to128 alphanumeric characters are allowed. Default: id |
unit | String | (Optional) Unit of measure.
From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. Default: Blank |
Response body
{ "updated":[ "" ], "failed":[ { "code":"", "id":"", "error":"" } ] }
Response example
{ "updated":[ "numCores" ], "failed":[ { "code":"43050005", "id":"memUsage", "error":"Attribute definition with {id}:[memUsage] does not exist" } ] }
Response parameters
Parameter |
Type |
Description |
---|---|---|
updated | String[ ] | List of updated attribute IDs. |
failed | Object[ ] | List of failed entities. |
failed:code | String | Eight-digit hexadecimal error code. |
failed:id | String | Failed attribute ID. |
failed:error | String | Error message. |
Status codes
Status code |
Message |
Description |
---|---|---|
200 | OK | Request was successful, and the response body contains the requested log details. |
206 | PARTIAL CONTENT | Request is in progress, and the incremental content is available in the response body. |
277 | PARTIAL OK | Request completed successfully with some failures. Check the response body for details. |
400 | BAD REQUEST | Request URL or request body validation failed. Check the response body for details. |
401 | UNAUTHORIZED | Supplied authentication token is invalid or does not have the appropriate credentials to access the resource. |
404 | NOT FOUND | API server could not find a resource matching the request. |
405 | METHOD NOT ALLOWED | Request HTTP method is not allowed for the operation. |
500 | SERVER ERROR | API operation request failed. Check the response body for details. |
Response codes
The following table lists the common API response codes that might be generated through the standard API. If an error response is not listed, examine the HTTP status codes to determine the best method for addressing the issue.
Response code | Message | Condition |
---|---|---|
43050005 | Attribute definition with {id}:[cpuUsage] does not exist. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The specified attribute definitions do not exist. |
4302000F | Invalid value specified for parameter {unit}. {unit} contains invalid characters. Valid characters are [alphanumeric, - and _]. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The attribute unit contains invalid characters. |
4302000F | Invalid value specified for parameter {unit}. {unit} length must be between 2 to 32 characters. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The attribute unit length is less than 2 or more than 32. |
4302000F | Invalid value specified for parameter {name}. {name} length must be between 2 to128 characters. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The specified attribute name exceeds the allowed length. |
4302000F | Invalid value specified for parameter {id}. {id} length must be between 2 to 32 characters. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The length of a static part of the attribute definition ID exceeds the allowed length. |
43050014 | Cannot update the read-only 'Attribute definition'. | Minimum of one attribute definition is updated and one or more attribute definitions failed to update. The attribute definition corresponding to the specified attribute definition ID is predefined. |
43040007 | No Attribute definition is specified. | The attribute definition is not specified for update. |
43010002 | Invalid JSON Request. | The specified JSON input is invalid. |
43050008 | Mandatory parameter {id} is not specified. | The parameter id is not specified. |
420000E4 | Mandatory parameter {dataset} is not specified. | The parameter dataset is not specified. |
430000E9 | License is not valid. | License is not uploaded, or the uploaded license is invalid or expired. |
430000E9 | Authorization needed. | Request is sent with an invalid authentication token. |
430000E4 | Dataset with {name}:[ds1] does not exist. | Request is sent for a dataset that does not exist. |
430000E0 | HTTP method [GET] is not supported for action [updateAttributeDef]. | Request is sent with any HTTP method other than POST. |
430500E2 | Application encountered an internal error. | API server encountered an unknown error. |