This API is used to create a user template for the DLI service. A maximum of 100 user templates can be created.
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
project_id |
Yes |
String |
Project ID, which is used for resource isolation. For details about how to obtain a project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
name |
Yes |
String |
Template name. The value can contain 1 to 64 characters. |
desc |
No |
String |
Template description. Length range: 0 to 512 characters. |
sql_body |
No |
String |
Stream SQL statement, which includes at least the following three parts: source, query, and sink. The value can contain 0 to 10,000 characters. |
tags |
No |
Array of objects |
Label of a Flink job template. For details, see Table 3. |
job_type |
No |
String |
Flink job template type.
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
key |
Yes |
String |
Tag key. NOTE:
A tag key can contain up to 36 characters and cannot start with a space. The following special characters are not allowed: =*<>\| NOTE:
A tag key can contain up to 128 characters, cannot start or end with a space, and cannot start with _sys_. Only letters, digits, spaces, and the following special characters are allowed: _.:+-@ |
value |
Yes |
String |
Tag value. NOTE:
A tag value can contain a maximum of 43 characters. Special characters (=*<>\|) are not allowed, and the value cannot start with a space. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
is_success |
No |
Boolean |
Indicates whether the request is successful. |
message |
No |
String |
Message content. |
template |
No |
Object |
Information about job update. For details, see Table 5. |
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
template_id |
No |
Long |
Template ID. |
name |
No |
String |
Template name. |
desc |
No |
String |
Template description. |
create_time |
No |
Long |
Time when the template is created. |
job_type |
No |
String |
Job template type. Options:
|
Create a job template named simple_stream_sql.
{
"name": "simple_stream_sql",
"desc": "Example of quick start",
"sql_body": "select * from source_table",
"job_type": "flink_sql_job"
}
{
"is_success": true,
"message": "A template is created successfully.",
"template": {
"template_id": 0,
"name": "IoT_example",
"desc": "Example of quick start",
"create_time": 1516952710040,
"job_type": "flink_opensource_sql_job"
}
}
Table 6 describes status codes.
If an error occurs when this API is called, the system does not return the result similar to the preceding example, but returns an error code and error message. For details, see Error Codes.