CreateTag

post

/20160918/tagNamespaces/{tag_namespace_id}/tags

Create a new tag in the specified tag namespace. The tag requires either the OCID or the name of the tag namespace that will contain this tag definition.

You must specify a name for the tag, which must be unique across all tags in the tag namespace and cannot be changed. The name can contain any ASCII character except the space or period characters. Names are case insensitive. That means, for example, "myTag" and "mytag" are not allowed in the same namespace. If you specify a name that is already in use in the tag namespace, a 409 error is returned.

The tag must have a description. The description does not need to be unique, and you can change it with UpdateTag.

The tag must have a value type, which is specified with a validator. Tags can use either a static value or a list of possible values. Static values are entered by a user applying the tag to a resource. Lists are created by you, and the user must apply a value from the list. Lists are validiated.

  • If no validator is set, the user applying the tag to a resource can type in a static value or leave the tag value empty.
  • If a validator is set, the user applying the tag to a resource must select from a list of values that you supply with EnumTagDefinitionValidator.
  • Request

    Supported Media Types
    Path Parameters
    Header Parameters
    • Minimum Length: 1
      Maximum Length: 64
      A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (for example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
    Body ()
    Request object for creating a new tag in the specified tag namespace.
    Root Schema : CreateTagDetails
    Type: object
    Show Source
    • definedTags
      Additional Properties Allowed: additionalProperties
      Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
    • Minimum Length: 1
      Maximum Length: 400
      The description you assign to the tag during creation.
    • freeformTags
      Additional Properties Allowed: additionalProperties
      Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
    • Indicates whether the tag is enabled for cost tracking.
    • Minimum Length: 1
      Maximum Length: 100
      The name you assign to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
    • BaseTagDefinitionValidator
      Discriminator: validatorType
      Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. If you define a validator after a value has been set for a defined tag, then any updates that attempt to change the value must pass the additional validation defined by the current rule. Previously set values (even those that would fail the current validation) are not updated. You can still update other attributes to resources that contain a non-valid defined tag. To clear the validator call UpdateTag with DefaultTagDefinitionValidator.
    Nested Schema : definedTags
    Type: object
    Additional Properties Allowed
    Show Source
    Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
    Nested Schema : freeformTags
    Type: object
    Additional Properties Allowed
    Show Source
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
    Nested Schema : BaseTagDefinitionValidator
    Type: object
    Discriminator: validatorType
    Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. If you define a validator after a value has been set for a defined tag, then any updates that attempt to change the value must pass the additional validation defined by the current rule. Previously set values (even those that would fail the current validation) are not updated. You can still update other attributes to resources that contain a non-valid defined tag. To clear the validator call UpdateTag with DefaultTagDefinitionValidator.
    Show Source
    Nested Schema : additionalProperties
    Type: object
    Additional Properties Allowed
    Show Source
    Key-value pair representing a defined tag key and value, scoped to a namespace. Example: {"CostCenter": "42"}
    Nested Schema : additionalProperties
    Type: object
    The value of the tag. Only the String type is supported.
    Back to Top

    Response

    Supported Media Types

    200 Response

    The tag is being created.
    Headers
    • For optimistic concurrency control. See if-match.
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Tag
    Type: object
    A tag definition that belongs to a specific tag namespace. "Defined tags" must be set up in your tenancy before you can apply them to resources. Avoid entering confidential information when you supply string values using the API.
    Show Source
    • Minimum Length: 1
      Maximum Length: 100
      The OCID of the compartment that contains the tag definition.
    • definedTags
      Additional Properties Allowed: additionalProperties
      Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
    • Minimum Length: 1
      Maximum Length: 400
      The description you assign to the tag.
    • freeformTags
      Additional Properties Allowed: additionalProperties
      Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
    • Minimum Length: 1
      Maximum Length: 100
      The OCID of the tag definition.
    • Indicates whether the tag is enabled for cost tracking.
    • Indicates whether the tag is retired.
    • Allowed Values: [ "ACTIVE", "INACTIVE", "DELETING", "DELETED" ]
      The tag's current state. After creating a tag, make sure its lifecycleState is ACTIVE before using it. After retiring a tag, make sure its lifecycleState is INACTIVE before using it. If you delete a tag, you cannot delete another tag until the deleted tag's lifecycleState changes from DELETING to DELETED.
    • Minimum Length: 1
      Maximum Length: 100
      The name assigned to the tag during creation. This is the tag key definition. The name must be unique within the tag namespace and cannot be changed.
    • Minimum Length: 1
      Maximum Length: 100
      The OCID of the namespace that contains the tag definition.
    • Minimum Length: 1
      Maximum Length: 100
      The name of the tag namespace that contains the tag definition.
    • Date and time the tag was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    • BaseTagDefinitionValidator
      Discriminator: validatorType
      Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. If you define a validator after a value has been set for a defined tag, then any updates that attempt to change the value must pass the additional validation defined by the current rule. Previously set values (even those that would fail the current validation) are not updated. You can still update other attributes to resources that contain a non-valid defined tag. To clear the validator call UpdateTag with DefaultTagDefinitionValidator.
    Nested Schema : definedTags
    Type: object
    Additional Properties Allowed
    Show Source
    Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"Operations": {"CostCenter": "42"}}
    Nested Schema : freeformTags
    Type: object
    Additional Properties Allowed
    Show Source
    Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. Example: {"Department": "Finance"}
    Nested Schema : BaseTagDefinitionValidator
    Type: object
    Discriminator: validatorType
    Validates a definedTag value. Each validator performs validation steps in addition to the standard validation for definedTag values. If you define a validator after a value has been set for a defined tag, then any updates that attempt to change the value must pass the additional validation defined by the current rule. Previously set values (even those that would fail the current validation) are not updated. You can still update other attributes to resources that contain a non-valid defined tag. To clear the validator call UpdateTag with DefaultTagDefinitionValidator.
    Show Source
    Nested Schema : additionalProperties
    Type: object
    Additional Properties Allowed
    Show Source
    Key-value pair representing a defined tag key and value, scoped to a namespace. Example: {"CostCenter": "42"}
    Nested Schema : additionalProperties
    Type: object
    The value of the tag. Only the String type is supported.
    Example Response (application-json)
    {   "name": "CostCenter",   "description": "This tag will show the cost center that will be used for billing of associated resources.",   "type": "string",   "tagNamespaceId": "ocid1.namespace.aaaaaaaaqexampleuniqueID",   "tagNameSpaceName": "BillingTags",   "compartmentId": "ocid1.tenancy.aaaaaaaabaexampleuniqueID",   "isRetired": "false",   "lifecycleState": "ACTIVE",   "timeCreated": "2017-09-01T18:13:12.210Z",   "isCostTracking": "true",   "validator": {} } 

    400 Response

    Bad Request
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    401 Response

    Unauthorized
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    404 Response

    Not Found
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    409 Response

    Conflict
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    429 Response

    Too Many Requests
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    500 Response

    Internal Server Error
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source

    Default Response

    An error has occurred.
    Headers
    • Unique Oracle-assigned identifier for the request. Provide this request OCID if you need to contact Oracle about this request.
    Body ()
    Root Schema : Error
    Type: object
    The properties that define an error.
    Show Source
    Back to Top