Querying the Template List

Function

This API is used to query the job template list. Currently, only custom templates can be queried.

The following parameters are involved in this API: cursor, limit, and order.

Table 1 Parameter description

Parameter

Description

cursor

Job ID.

limit

Maximum number of records that can be queried.

order

Query result display. Value asc indicates that the query results are displayed in ascending order, and value desc indicates that the query results are displayed in descending order.

URI

  • URI format

    GET /v1.0/{project_id}/job_templates

  • Parameter description
    Table 2 URI parameter description

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

None

Response

  • Example response
    {
      "message_id": "CS.18011",
      "message": "The template list is obtained successfully.",
      "payload": {
        "total": 1,
        "templates": [
          {
            "template_id": 12,
            "name": "simple_stream_sql",
    "desc": "Example of quick start",
            "create_time": 1550218731820,
            "update_time": 1550218731820,
            "sql_body": "select * from source_table"
          }
        ]
      },
      "current_time": 1550218761109
    }
  • Parameter description
    Table 3 Response parameters

    Parameter

    Mandatory

    Type

    Description

    message_id

    No

    Sting

    Message type ID.

    message

    No

    Sting

    Message content.

    current_time

    No

    Int

    Current time, expressed by milliseconds.

    payload

    No

    None

    Information about the template list.

    total

    No

    Int

    Total number of templates.

    templates

    No

    None

    Detailed information about a template.

    template_id

    No

    Int

    Template ID.

    name

    No

    String

    Template name.

    desc

    No

    String

    Template description.

    create_time

    No

    Int

    Time when the template is created.

    update_time

    No

    Int

    Update time of the template.

    sql_body

    No

    String

    Stream SQL statement, which includes at least the following three parts: source, query, and sink.

Status Code

Table 4 describes the status code.

Table 4 Status code

Status Code

Description

200

Template list query succeeds.

400

The input parameters are invalid.

Error Code

For details, see Error Codes.