REST API - create

cis tagging category: create

Creates a category. To invoke this operation, you need the create category privilege.

Request:

HTTP request

POST https://{server}/rest/com/vmware/cis/tagging/category

Request Body Structure:

{
    "create_spec"{
        "associable_types"[
            "string",
            "string"
        ],
        "category_id""obj-103",
        "name""string",
        "description""string",
        "cardinality""SINGLE"
    }
}

Request Body Parameters:

Name Type Description
bold = required
create_spec create_spec Specification for the new category to be created.
create_spec.name string The display name of the category.

create_spec.description string The description of the category.

create_spec.cardinality string The associated cardinality (SINGLE, MULTIPLE) of the category.

Defines the number of tags in a category that can be assigned to an object. Value is one of:
SINGLE: An object can only be assigned one of the tags in this category. For example, if a category is "Operating System", then different tags of this category would be "Windows", "Linux", and so on. In this case a VM object can be assigned only one of these tags and hence the cardinality of the associated category here is single.
MULTIPLE: An object can be assigned several of the tags in this category. For example, if a category is "Server", then different tags of this category would be "AppServer", "DatabaseServer" and so on. In this case a VM object can be assigned more than one of the above tags and hence the cardinality of the associated category here is multiple.

create_spec.associable_types string[] Object types to which this category's tags can be attached.

create_spec.category_id string This attribute was added in vSphere API 6.7.

Optional. If unset an identifier will be generated by the server. When clients pass a value of this structure as a parameter, the field must be an identifier for the resource type: com.vmware.cis.tagging.Category. When operations return a value of this structure as a result, the field will be an identifier for the resource type: com.vmware.cis.tagging.Category.

Response:

HTTP Status Code: 200

Representation:

{
    "value""obj-103"
}

Response Type:

Name Type Description
bold = required
value string The identifier of the created category.

Errors:

HTTP Status Code Type Description
400 already_exists if the cis.tagging.category.create_spec.name provided in the create_spec is the name of an already existing category.
400 invalid_argument if any of the information in the create_spec is invalid.
403 unauthorized if you do not have the privilege to create a category.