Create a User Tag

POST/zstack/v1/user-tags

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "resourceType": "DiskOfferingVO",
    "resourceUuid": "beff527f6ccb45c8b215c59434b2fa5c",
    "tag": "for-large-DB"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"resourceType":"DiskOfferingVO","resourceUuid":"0a93a8d099a9339bb21b6e14a4ca3eea","tag":"for-large-DB"}}' \
http://localhost:8080/zstack/v1/user-tags

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
resourceTypeStringbody (contained in the params structure)When creating a tag, the user must specify the resource type associated with the tag. 0.6
resourceUuidStringbody (contained in the params structure)User-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource. 0.6
tagStringbody (contained in the params structure)Tag string 0.6
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "b97c64cbf0524f809c05bf9eaf262b79",
    "resourceType": "DiskOfferingVO",
    "tag": "for-large-DB",
    "type": "User",
    "createDate": "May 11, 2017 1:22:33 PM",
    "lastOpDate": "May 11, 2017 1:22:33 PM"
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeThe error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error0.6
inventoryUserTagInventoryFor details, see inventory0.6

error

NameTypeDescriptionStarting Version
codeStringThe error code number. A globally unique identifier for the error, for example, SYS.1000, HOST.1001.0.6
descriptionStringA brief description of the error0.6
detailsStringDetailed information about the error0.6
elaborationStringReserved field. Default is null.0.6
opaqueLinkedHashMapReserved field. Default is null.0.6
causeErrorCodeThe root error. The source error that caused the current error. If there is no root error, this field is null.0.6

inventory

NameTypeDescriptionStarting Version
uuidStringThe UUID of the resource. Uniquely identifies the resource.0.6
resourceUuidStringUser-specified resource UUID. If specified, the system will not randomly assign a UUID to the resource.0.6
resourceTypeStringWhen creating a tag, the user must specify the resource type associated with the tag.0.6
tagStringTag string0.6
typeStringReserved field. Do not use.0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

SDK Examples

Java SDK

CreateUserTagAction action = new CreateUserTagAction();
action.resourceType = "DiskOfferingVO";
action.resourceUuid = "824246fa21d8405fbd48ea1cc7dbf049";
action.tag = "for-large-DB";
action.sessionId = "5d9cde1f7e6a43f586ec78dedf743201";
CreateUserTagAction.Result res = action.call();

Python SDK

CreateUserTagAction action = CreateUserTagAction()
action.resourceType = "DiskOfferingVO"
action.resourceUuid = "11f5e230f43d49e69815c35fbd39bad5"
action.tag = "for-large-DB"
action.sessionId = "6301b756253c4103adbf8c891d858e5f"
CreateUserTagAction.Result res = action.call()