Creating a Training Job Tag
Function
This API is used to add tags to an existing training job.
This API is used when you need to classify, mark, or manage a training job. You can add one or more tags to a specified training job using this API. If the key of the added tag already exists, the value of the tag is overwritten. Before using this API, ensure that the training job exists and you have the required permission. After the tag is added, you can view the tag information in the training job list. If the training job does not exist or you do not have the required permission, the API will return an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
URI
POST /v2/{project_id}/modelarts-training-job/{training_job_id}/tags/create
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: User project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: N/A Default Value: N/A |
| training_job_id | Yes | String | Definition: Training job ID. For details, see Obtaining Training Jobs. Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
| 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 | No | 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
| Parameter | Type | Description |
|---|---|---|
| tags | Array of TmsTagResp objects | Definition: TMS tags. |
Example Requests
Create a training job tag. The TMS tags have been configured by setting the keys to 111 and k3, and the corresponding values are set to k3 and v2.
POST https://{endpoint}/v2/{project_id}/modelarts-training-job/{training_job_id}/tags/create
{
"tags" : [ {
"key" : "111",
"value" : "v2"
}, {
"key" : "k3",
"value" : "v2"
} ]
} Example Responses
Status code: 204
Added.
{
"tags" : [ {
"key" : "111",
"value" : "v2"
}, {
"key" : "k3",
"value" : "v2"
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 204 | Added. |
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