UpdateJobTemplate
Updates a task template.
Try it now
Test
RAM authorization
Request syntax
PUT /api/v1/jobtemplates/{TemplateId} HTTP/1.1
Path Parameters
|
Parameter |
Type |
Required |
Description |
Example |
| TemplateId |
string |
Yes |
The unique identifier of the task template. |
tplmceolmf2**** |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body parameters. |
|
| TemplateName |
string |
No |
The name of the task template. |
job-template-example-1778047**** |
| Description |
string |
No |
The description of the task template. |
Template description |
| Metadata |
object |
No |
The user-defined key-value metadata. |
{} |
| Content |
string |
No |
The configuration content of the task template. It supports all parameter fields of the CreateJob operation and must be passed in JSON format. A new version is created when this parameter is provided. |
{\"WorkspaceId\":\"15****05\",\"JobType\":\"PyTorchJob\",\"UserCommand\":\"echo hello\",\"JobSpecs\":[{\"Type\":\"Worker\",\"PodCount\":1,\"Image\":\"dsw-registry-vpc.cn-hangzhou.cr.aliyuncs.com/pai/pytorch:2.8.0-gpu-py313-cu129-ubuntu22.04-3995b779-1764361782\",\"EcsSpec\":\"ecs.gn7i-c8g1.2xlarge\"}],\"ResourceType\":\"ECS\",\"_ResourcePaymentType\":\"PostPaid\",\"CredentialConfig\":{\"EnableCredentialInject\":false},\"Accessibility\":\"PRIVATE\",\"Settings\":{\"JobReservedMinutes\":0,\"Tags\":{}}} |
| Constraints |
object |
No |
The field constraint rules. The key is a JSONPath expression, and the value is the constraint type: locked (locked and cannot be overridden), overridable (can be overridden), or required (required). This parameter must be provided together with Content and cannot be updated separately. |
{"JobSpecs[0].Image":"locked","UserCommand":"locked","JobType":"locked"} |
| SetAsDefault |
boolean |
No |
Specifies whether to set the new version as the default version when a new version is created. |
true |
| version |
integer |
No |
The invalid field. |
Invalid field |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Version |
integer |
The version number. |
2 |
| VersionCreated |
boolean |
Indicates whether a new version is created. |
true |
| DefaultVersion |
integer |
The default version number currently in use. |
2 |
| GmtModifyTime |
string |
The last modification time of the template. |
2021-01-12T14:36:00Z |
| RequestId |
string |
The ID of the request, which is used for diagnostics and troubleshooting. |
473469C7-AA6F-4DC5-B3DB-xxxxxxx |
Examples
Success response
JSON format
{
"Version": 2,
"VersionCreated": true,
"DefaultVersion": 2,
"GmtModifyTime": "2021-01-12T14:36:00Z",
"RequestId": "473469C7-AA6F-4DC5-B3DB-xxxxxxx"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.