Updated on 2026-01-08 GMT+08:00

Creating a Job Template

Function

This API is used to create a job template.

Authorization

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 the required permissions in Introduction.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    dli:template:create

    write

    template *

    -

    -

    -

URI

  • URI format

    POST /v3/{project_id}/templates

  • Parameter description
    Table 1 URI parameter

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.

Request Parameters

Table 2 Parameters

Parameter

Mandatory

Type

Description

type

Yes

String

Template type. Available values are as follows:

  • SQL: SQL template
  • SPARK: Spark template

name

Yes

String

Template name

body

Yes

String

Template content

group

No

String

Template group name

description

No

String

Description of the template

language

No

String

Language

Response

Table 3 Parameters

Parameter

Type

Description

id

String

Template ID

Example Request

Create a SQL job template whose content is test sql.

{ 
    "type": "SQL",
    "name": "test",
    "description": "",
    "body": "test aql",
    "group": "" 
 }

Example Response

{ 
    "id":"85aad9e5-3766-46c2-b3c0-16c2832e52e8"
 }

Status Codes

Status Code

Description

200

OK

Error Codes

For details, see Error Codes.