GetJobTemplate

更新时间:
复制 MD 格式

Retrieves the details of a job template.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

GET /api/v1/jobtemplates/{TemplateId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

TemplateId

string

Yes

The ID of the job template.

tplmceolmf2****

Request parameters

Parameter

Type

Required

Description

Example

Version

string

No

The version to retrieve. If omitted, the default version is returned. Specify all to retrieve all versions.

all

Response elements

Element

Type

Description

Example

object

Details of the job template.

TemplateId

string

The ID of the job template.

tplmceolmf2****

TemplateName

string

The name of the job template.

job-template-example-1778047****

Description

string

A description of the job template.

job template description

Metadata

object

A collection of user-defined key-value pairs.

{}

UserId

string

The ID of the user who created the job template.

20**************26

WorkspaceId

string

The ID of the workspace that contains the job template.

4***9

TenantId

string

The ID of the tenant that owns the job template.

142388383837****

DefaultVersion

integer

The default version of the job template.

2

GmtCreateTime

string

The time the job template was created.

2026-01-08T14:17:55Z

GmtModifyTime

string

The time the job template was last modified.

2026-03-03T05:48:02Z

ModifiedBy

string

The ID of the user who last modified the job template.

20**************26

Versions

array<object>

An array of template versions. This array contains only one version if a specific version is requested, or all versions if all is specified.

array<object>

Details of a template version.

Version

integer

The version number.

2

Content

any

The configuration of the version, in JSON format.

{\"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

The field constraint rules. The key is a JSONPath expression and the value is a constraint type.

{\"JobSpecs[0].Image\":\"locked\",\"UserCommand\":\"locked\",\"JobType\":\"locked\"}

CreatedBy

string

The ID of the user who created the version.

20**************26

GmtCreateTime

string

The time the version was created.

2026-01-08T14:17:55Z

TotalCount

integer

The total number of versions returned. This value is 1 if a specific version is queried, or the total count if all versions are queried.

100

RequestId

string

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Success response

JSON format

{
  "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****"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.