Create and Assign Tags

post

/paas/api/v1.1/tags/{identityDomainId}/tags

This endpoint is not available on Oracle Cloud at Customer.

Creates instance tags and assigns them to existing resources in the same request. You can also create instance tags without creating assignments.

Note: This endpoint can be used to assign existing account non-metering tags to resources. The endpoint cannot be used to assign existing account metering tags, or create account tags of any type.

Request

Supported Media Types
Path Parameters
Header Parameters
Body ()
The request body defines the tags to create and the services to assign the tags to.
Root Schema : createassigntags-request
Type: object
Show Source
Nested Schema : assignments
Type: object
Groups the tag assignments to create.
Show Source
  • services
    Groups the service resources to tag.

    With instance tags, each new tag created is assigned to each service resource.

    With account non-metering tags, each tag is assigned to each service resource.

Nested Schema : tags
Type: array
Groups the instance tags to create.

For account non-metering tags, groups the tags to assign.

Each tag object is a key/value pair.

Show Source
Nested Schema : services
Type: array
Groups the service resources to tag.

With instance tags, each new tag created is assigned to each service resource.

With account non-metering tags, each tag is assigned to each service resource.

Show Source
Nested Schema : assign-request
Type: object
Show Source
Nested Schema : tagscreate-request
Type: object
Each tag is a key/value pair.

For account non-metering tags, specify the existing tag key and value for assignment.

Show Source
  • Specify the key for this instance tag to create. A tag key can contain letters, numbers, dashes (-), and underscores ( _ ), and it can contain up to 128 characters.
  • Specify the value for this instance tag to create. A tag value can contain up to 256 characters and is case-sensitive.

    Default value is an empty string (if you do not provide a specific value).

Response

Supported Media Types

200 Response

OK.
Body ()
The response body contains information about all tags and their assignments.
Root Schema : tagsassignments-response
Type: array
The response body contains information about all tags and their assignments.
Show Source
Nested Schema : tagsassignments-details
Type: object
Each object describes a tag and its assignments.
Show Source
Nested Schema : assignments
Type: object
Groups assignment details for this tag.
Show Source
Nested Schema : services
Type: array
Groups the service resources assigned with this tag.
Show Source
Nested Schema : serviceassignment-details
Type: object
Each object describes a service resource.
Show Source
  • Whether tag assignment or unassignment is in progress. Possible values: Assigning, Unassigning, Assigned

    This property is not shown when you use the Create and Assign Tags endpoint or Create and Delete Assignments endpoint.

  • Name of the service instance.
  • Type of service.

    For example, MySQL for a MySQL Cloud Service instance and DBaas for a Database Cloud Service deployment.

400 Response

Bad request.
Body ()
Root Schema : failed-response
Type: object
Show Source
Nested Schema : details
Type: object
Groups details of a bad request, not found response, or conflict response.
Show Source
Nested Schema : issues
Type: array
List of operation issues found.
Show Source

Examples

The following example shows how to create tags and assign them in the same POST request using cURL.

Note: The command in this example uses the URL structure https://rest_server_url/resource-path, where rest_server_url is the REST server to contact for your identity domain (or Cloud Account). See Send Requests.

cURL Command

curl -i -X POST -u username:password -d @createassigntags.json -H "Content-Type:application/json" -H "X-ID-TENANT-NAME:ExampleIdentityDomain" "https://rest_server_url/paas/api/v1.1/tags/ExampleIdentityDomain/tags"

Example of Request Body

The following example shows the contents of the request body in JSON format.

At least one tag key/value pair must be specified. The request may contain a list of existing resources to which the new tag will be assigned.

{
  "tags": [
    {
      "key": "environment",
      "value": "qa"
    }
  ],
  "assignments": {
    "services": [
      {
        "serviceType": "MySQLCS",
        "serviceName": "MyExample"
      }
    ]
  }
}

Example of Response Header

The following shows an example of the response header.

HTTP/1.1 200 OK
Date: Fri, 05 Jan 2018 19:02:23 GMT
Content-Length: 142
Content-Type: application/vnd.com.oracle.oracloud.provisioning.Service+json
X-ORACLE-DMS-ECID: 1bcaf164-c5b5-4c70-b7d8-5a24c1e19493-00000a8a
X-Frame-Options: DENY
Access-Control-Allow-Methods: GET, POST, DELETE, PUT, OPTIONS, HEAD
Access-Control-Allow-Headers: Content-Type, api_key, Authorization, X-ID-TENANT-NAME, X-USER-IDENTITY-DOMAIN-NAME
Access-Control-Allow-Origin: *l/paas/api/v1.1/activitylog/ExampleIdentityDomain/job/1450657
Content-Type: application/json

Example of Response Body

The following shows an example of the response body in JSON format.

One tag is created. The new tag is assigned to one service resource.

[
   {
      "key":"environment",
      "value":"qa",
      "assignments":{
         "services":[
            {
               "serviceType":"MySQLCS",
               "serviceName":"MyExample"
            }
         ]
      }
   }
]