Deleting a resource definition

Ops Center Analyzer Detail View REST API Reference Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ANA004-11

You can delete a resource definition. If the resource definition type is being used by another resource definition, then it is not deleted. If the resource definition does not exist, then an error message is received in the response message. You can delete multiple resource definitions in a single request.

You cannot delete resource definitions that are in a circular reference relation.

For example, resources A, B, and C are circularly referencing each other as follows: A=>B, B=>C, C=>A.

Here, A =>B implies that resource definition A is referenced by resource definition B. In this case, neither resource definition can be deleted.

Request line

baseURL/dbapi.do?action=deleteResourceDef&dataset=<Datasetname>

Request body

{
  "types":[
    "",
    "",
    ""
  ]
}

Request example using GET

GET /dbapi.do?action=deleteResourceDef&dataset=defaultDs&types=host,vm,storage HTTP /1.1 Authorization:Basic ZnJlZDpmcmVk

Request example using POST

POST /dbapi.do?action=deleteResourceDef&dataset=defaultDs HTTP /1.1 Authorization:Basic ZnJlZDpmcmVk
{
  "types":[
    "host",
    "vm",
    "storage"
  ]
}

Request parameters

Parameter Type Description
action String deleteResourceDef

Specify the API function to be invoked.

dataset String Dataset name. From 2 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed.
types String[ ] One or more comma-separated resource types.

From 1 to 32 alphanumeric, underscore (_), and hyphen (-) characters are allowed.

Response body

{
  "deleted":[
    ""
  ],
  "failed":[
    {
      "code":"",
      "type":"",
      "error":""
    }
  ]
}

Response example

{
  "deleted":[
    "vm"
  ],
  "failed":[
    {
      "code":"34050011",
      "type":"host",
      "error":"Resource definition deletion failed due to dependency on one or more other resources"
    },
    {
      "code":"34050005",
      "type":"storage",
      "error":"Resource definition with {type}:[storage] does not exist"
    }
  ]
}

Response parameters

Parameter

Type

Description

deleted String[ ] List of deleted resource 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.

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.
Note: If all of the specified resource definitions fail, then the 500 SERVER ERROR message is received in the response message.

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
3402000F Invalid value specified for parameter {type}. Resource {type}:[!] contains invalid characters. Valid characters are [alphanumeric, - and _]. Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. Specified resource type contains invalid characters.
34050008 Mandatory parameter {type} not specified. Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. The resource definition type is not specified as a request parameter.
3402000F Invalid value specified for parameter {type}. Resource {type}:[IAmSuchABigStringWhichIsNotAllowedAsResourceTypeInMARSBM] length must be between 1-32 characters. Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. Specified resource definition type is not valid in terms of allowed length.
34050005 Resource definition with {type}:[vm] does not exist Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. Specified resource definitions type does not exist.
34050014 Cannot delete read-only 'Resource definition' Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. The resource definition corresponding to the specified resource definition type is pre-defined.
34050011 Resource definition deletion failed due to dependency on one or more other resources Minimum of one resource definition is deleted and the deletion of one or more resource definition types failed. Specified resource definition is dependent on some other resource definitions.
34030007 No Resource definition is specified Parameter types are not specified or the specified parameter is not of type string.
34010002 Invalid JSON Request Specified JSON input is invalid.
340000E9 License is not valid License is not uploaded, or the uploaded license is invalid or expired.
340000E9 Authorization needed Request is sent with an invalid authentication token.
34050005 Dataset with {name}:[ds1] does not exist Request is sent for a dataset that does not exist.
340500E0 HTTP method [PUT] is not supported for action [deleteResourceDef] Request is sent with any HTTP method other than POST.
340000E2 Application encountered an internal error API server encountered an unknown error.