Adding a Resource Tag
Function
This API is used to add tags to specified real-time services. If a tag to be added has the same key as an existing tag, the tag will overwrite the existing one.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
POST /v1/{project_id}/services/{resource_id}/tags/create
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: The value can contain 1 to 64 characters. Letters, digits, and hyphens (-) are allowed. Range: N/A Default Value: N/A |
|
resource_id |
Yes |
String |
Resource ID (service ID) |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
Yes |
String |
Definition: Enter application/json;charset=utf8. Constraints: N/A Range: N/A Default Value: N/A |
|
X-Auth-Token |
Yes |
String |
Definition: User token. It can be obtained by calling the IAM API. The token is the value of X-Subject-Token in the response header. Constraints: N/A Range: N/A Default Value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
tags |
Yes |
Array of TmsTag objects |
Definition: TMS tags. Constraints: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
key |
Yes |
String |
Definition: Key of a TMS tag. Constraints: The value can contain at most 128 characters and cannot start or end with sys. Only letters, digits, spaces, and special characters (_.:=+-@) are allowed. Range: N/A Default Value: N/A |
|
value |
Yes |
String |
Definition: Value of a TMS tag. Constraints: The value can contain at most 255 characters. Only letters, digits, spaces, and special characters (_.:/=+-@) are allowed. Range: N/A Default Value: N/A |
Response Parameters
Status code: 204
The tag is added.
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Status code: 401
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Status code: 403
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Status code: 404
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Range: N/A |
|
error_msg |
String |
Definition: Error message. Range: N/A |
Example Requests
The following is an example of how to add tags to a specified service. The TMS tags have been configured by setting the keys to test and model_version, and setting the corresponding values to service-gpu and 0.1.
https://{endpoint}/v1/{project_id}/services/a55eba18-1ebf-4e9a-8229-d2d3b593a3dc/tags/create
{
"tags" : [ {
"key" : "test",
"value" : "service-gpu"
}, {
"key" : "model_version",
"value" : "0.1"
} ]
}
Example Responses
None
Status Codes
|
Status Code |
Description |
|---|---|
|
204 |
The tag is added. |
|
400 |
Invalid parameter |
|
401 |
Authentication failed. |
|
403 |
Insufficient permissions |
|
404 |
Resources not found |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot