Creating a Template
Function
This API is used to create a user template for the DLI service. A maximum of 100 user templates can be created.
URI
- URI format
- 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
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. Length range: 0 to 2,048 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. The default value is flink_sql_job. You can only set this parameter to flink_sql_job or flink_opensource_sql_job. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key.
NOTE:
A tag key can contain a maximum of 36 characters. Special characters (=*<>\|) are not allowed, and the key cannot start with a space. |
value |
Yes |
String |
Tag key.
NOTE:
A tag value can contain a maximum of 43 characters. Special characters (=*<>\|) are not allowed, and the value cannot start with a space. |
Response
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. |
Example Request
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" }
Example Response
{ "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" } }
Status Codes
Table 6 describes status codes.
Error Codes
If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.