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.
Debugging
You can debug this API in API Explorer.
URI
- URI format
- Parameter description
Table 1 URI parameters 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. Length range: 0 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 Strings | 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 set this parameter to flink_sql_job or flink_opensource_sql_job only. |
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
- Example request
{ "name": "simple_stream_sql", "desc": "Example of quick start", "sql_body": "select * from source_table" } - 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, } }
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 Code.
Last Article: APIs Related to Flink Job Templates
Next Article: Updating a Template
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.