You can update the resource definitions in a dataset. If the requested resource definition does not exist, then an error message is received in the response message. You can update multiple resource definitions in a single request.
You cannot update the predefined resource definitions.
Request line
POST baseURL/dbapi.do?action=updateResourceDef&dataset=<Datasetname>
Request body
[ { "type":"", "name":"", "attributes":{ "add":[ "" ], "remove":[ "" ] } }, { "type":"", "name":"", "attributes":{ "completeList":[ " ", "" ] }, "relations":{ "add":[ "" ] } } ]
Request example
POST /dbapi.do?action=updateResourceDef&dataset=defaultDs HTTP /1.1 Authorization:Basic ZnJlZDpmcmVk
[ { "type":"vm", "name":"VM Updated", "attributes":{ "add":[ "cpuUsage" ], "remove":[ "memUsage" ] } }, { "type":"host", "name":"Host Updated", "attributes":{ "completeList":[ "cpuCores ", "cpuUsage" ] }, "relations":{ "add":[ "vm" ] } } ]
Request parameters
Parameter | Type | Description |
---|---|---|
action | String | updateResourceDef
Specify the API function to be invoked. |
dataset | String | Dataset name. From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. |
type | String | A unique resource definition type.
From 1 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. |
name | String | (Optional) Resource definition name.
From 1 to 32 alphanumeric characters are allowed. Default: type |
attributes | Object[ ] | (Optional) Scalar and timeseries attributes.
An existing attribute ID. Default: Blank |
relations | Object[ ] | (Optional) Related resource definition types.
A valid resource definition type. Default: Blank |
additionalProperties | String[ ] |
(Optional) Additional key value pairs to be stored the with resource definition. This adds new properties in resource definition and updates already existing additional properties. Note: Properties type, name, relations and attributes cannot be specified in additionalProperties as they constitute a resource definition. JSON object having valid key value pairs. Maximum 128 key value pairs can be specified. Key: From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed. Value: From 1 to 1024 alphanumeric characters are allowed, \,",&,<,>, and ' are not allowed. |
- add Contains a list of scalar and timeseries attributes to be added.
- remove Contains a list of scalar and time series attributes to be removed.
- completeList Contains a complete list of scalar and timeseries attributes. If this list is present, it will overwrite all existing attributes.
Similarly, parameter relations can also have add, remove, or completeList.
Response body
{ "updated":[ "" ], "failed":[ { "code":"", "type":"", "error":"" } ] }
Response example
{ "updated":[ "vm" ], "failed":[ { "code":"33020010", "type":"host", "error":"Resource definition updation failed due to already existing relation. Resource type [ host ] already has relation with [ vm ]." } ] }
Response parameters
Parameter |
Type |
Description |
---|---|---|
updated | String[ ] | List of updated resource definition types. |
failed | Object[ ] | List of failed entities. |
failed:code | String | Eight-digit hexadecimal error code. |
failed:type | String | Failed resource type. |
failed:error | String | Error message. |
Return 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 |
---|---|---|
33010008 | Mandatory parameter {type} not specified. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The resource definition type is not specified or the specified resource type is not of parameter type string. |
3301000F | Invalid value specified for parameter {name}. It must be of type string. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The resource definition name is not of parameter type string. |
3301000E | [add1] is not a valid key in parameter {{attributes}}. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter attributes contains an invalid key. |
3301000F | Invalid value specified for parameter {attributes}. Atleast one correct key must be specified in {attributes}. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter attributes does not contain any key. |
3301000F | Invalid value specified for parameter {attributes}. It must be of type JSON object. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter attributes is not a JSON object. |
3301000F | Invalid value specified for parameter {add}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter add in attributes is not of type JSON array. |
3301000F | Invalid value specified for parameter {completeList}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter completeList in attributes is not of type JSON array. |
3301000F | Invalid value specified for parameter {remove}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter remove in attributes is not of type JSON array. |
3301000E | [add1] is not a valid key in parameter {{relations}}. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter relations contains an invalid key. |
3301000F | Invalid value specified for parameter {relations}. Atleast one correct key must be specified in relations. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter relations does not contain the key. |
3301000F | Invalid value specified for parameter {relations}. It must be of type JSON object. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter relations is not a JSON object. |
3301000F | Invalid value specified for parameter {add}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter add in relations is not of type JSON array. |
3301000F | Invalid value specified for parameter {completeList}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter completeList in relations is not of type JSON array. |
3301000F | Invalid value specified for parameter {remove}. It must be of type JSON array. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter remove in relations is not of type JSON array. |
3301000F | Invalid value specified for parameter {additionalProperties}. It must be of type JSON object. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The parameter additionalProperties is not of type JSON object. |
3301000A | Nothing specified for update. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The request does not contain any parameter. |
3302000F | Invalid value specified for parameter {type}. Resource {type}:[!!] contains invalid characters. Valid characters are [alphanumeric, - and _]. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified resource type contains invalid characters. |
3302000F | Invalid value specified for parameter {type}. Resource {type}:[IAmSuchABigStringWhichIsNotAllowedAsResourceTypeInMARSBM] length must be between 1-32 characters. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified resource type is not valid in terms of allowed length. |
3302000F | Invalid value specified for parameter {name}. {name} length must be between 2-32 characters. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified resource name is not valid in terms of allowed length. |
3302000F | Invalid value specified for parameter {type}. Resource {type}:[] length must be between 1-32 characters. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified relation is not valid in terms of allowed length. |
3302000F | Invalid value specified for parameter {type}. Resource {type}:[!@] contains invalid characters. Valid characters are [alphanumeric, - and _]. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified relations contain invalid characters. |
33020010 | Resource definition updation failed due to self relation. Remove self relation from resource definition [host]. | Resource definition contains relation to itself. |
33020010 | Resource definition updation failed due to already existing relation. Resource type [host] already has relation with [vm]. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The specified relation is already defined through related resource type. |
33020012 | updateResourceDef failed for {type}:[h]. Number of additional properties can not be more than 128 in a resource definition. | Minimum of one resource definition is updated and one or more resource definitions failed to update. More than 128 addtionalProperties are specified. |
33020012 | updateResourceDef failed for {type}:[h]. Additional properties key cannot be one oftype,configAttributes,displayName or directRelations. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The not allowed property is specified in the additionalProperties. |
33020012 | updateResourceDef failed for {type}:[h]. Invalid keys for additional properties. Keys :[{!@}] | Minimum of one resource definition is updated and one or more resource definitions failed to update. The key specified in the additionalProperties contains invalid characters. |
33020012 | updateResourceDef failed for {type}:[h]. Invalid keys for additional properties. Keys :[{}] | Minimum of one resource definition is updated and one or more resource definitions failed to update. The key specified in additionalProperties is not valid in terms of allowed length. |
33020012 | updateResourceDef failed for {type}:[h]. Value(s) for following additional properties are invalid. :[{12}] | Minimum of one resource definition is updated and one or more resource definitions failed to update. The value specified for a key in additionalProperties is not of parameter type string. |
33020012 | updateResourceDef failed for {type}:[h]. Value(s) for following additional properties are invalid. :[{12}] | Minimum of one resource definition is updated and one or more resource definitions failed to update. The value specified for a key in the additionalProperties is not valid in terms of allowed length. |
33020012 | updateResourceDef failed for {type}:[h]. Value(s) for following additional properties are invalid. :[{12}] | Minimum of one resource definition is updated and one or more resource definitions failed to update. The value specified for a key in additionalProperties contains an invalid character. |
33050014 | Cannot update read-only 'Resource definition'. | Minimum of one resource definition is updated and one or more resource definitions failed to update. The resource definition corresponding to the specified resource definition type is pre-defined. |
33050005 | Resource definition with {type}:[host] does not exist. | Minimum of one resource definition is updated and one or more resource definitions failed to update. Specified resource definitions do not exist. |
33010002 | Invalid JSON Request. | Specified JSON input is invalid or the resource definition is not specified for update. |
330000E9 | License is not valid. | License is not uploaded, or uploaded license is invalid or expired. |
330000E9 | Authorization needed. | Request is sent with an invalid authentication token. |
330000E4 | Dataset with {name}:[ds1] does not exist. | Request is sent for a dataset that does not exist. |
330000E0 | HTTP method [GET] is not supported for action [updateResourceDef]. | Request is sent with any HTTP method other than the POST. |
330000E2 | Application encountered an internal error. | API server encountered an unknown error. |