获取任务模板详情。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
GET /api/v1/jobtemplates/{TemplateId} HTTP/1.1
路径参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| TemplateId |
string |
是 |
任务模板的唯一标识 |
tplmceolmf2**** |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| Version |
string |
否 |
不传返回默认版本;传具体数字返回该版本;传 all 返回全部版本 |
all |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
任务模板详情 |
||
| TemplateId |
string |
任务模板的唯一标识 |
tplmceolmf2**** |
| TemplateName |
string |
任务模板的名称 |
job-template-example-1778047**** |
| Description |
string |
任务模板的描述信息 |
job template description |
| Metadata |
object |
用户自定义的键值对元数据 |
{} |
| UserId |
string |
创建模板的用户 ID |
20**************26 |
| WorkspaceId |
string |
模板所属的工作空间 ID |
4***9 |
| TenantId |
string |
模板所属的租户 ID |
142388383837**** |
| DefaultVersion |
integer |
当前使用的默认版本号 |
2 |
| GmtCreateTime |
string |
模板的创建时间 |
2026-01-08T14:17:55Z |
| GmtModifyTime |
string |
模板的最后修改时间 |
2026-03-03T05:48:02Z |
| ModifiedBy |
string |
最后修改模板的用户 ID |
20**************26 |
| Versions |
array<object> |
模板版本详情列表。查询单个版本时返回 1 个元素,查询所有版本时返回全部 |
|
|
array<object> |
版本列表。 |
||
| Version |
integer |
版本号 |
2 |
| Content |
any |
该版本的模板配置内容,JSON 格式 |
{\"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 |
字段约束规则。Key 为 JSONPath 表达式,Value 为约束类型 |
{\"JobSpecs[0].Image\":\"locked\",\"UserCommand\":\"locked\",\"JobType\":\"locked\"} |
| CreatedBy |
string |
版本创建者 ID |
20**************26 |
| GmtCreateTime |
string |
版本创建时间 |
2026-01-08T14:17:55Z |
| TotalCount |
integer |
版本总数,查询单个版本返回 1,查询所有版本返回实际总数 |
100 |
| RequestId |
string |
本次请求的 ID,用于诊断和答疑。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** |
示例
正常返回示例
JSON格式
{
"TemplateId": "tplmceolmf2****",
"TemplateName": "job-template-example-1778047****",
"Description": "job template description",
"Metadata": {},
"UserId": "20**************26",
"WorkspaceId": "4***9",
"TenantId": "142388383837****",
"DefaultVersion": 2,
"GmtCreateTime": "2026-01-08T14:17:55Z",
"GmtModifyTime": "2026-03-03T05:48:02Z",
"ModifiedBy": "20**************26",
"Versions": [
{
"Version": 2,
"Content": "{\\\"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": {
"test": "test",
"test2": 1
},
"CreatedBy": "20**************26",
"GmtCreateTime": "2026-01-08T14:17:55Z"
}
],
"TotalCount": 100,
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。