Creating a Custom Template
Function
This API is used to create a custom template.
Calling Method
For details, see Calling APIs.
URI
POST /v2/{project_id}/config-templates
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
template_id |
Yes |
String |
Default template ID. |
name |
Yes |
String |
Template name. |
type |
Yes |
String |
Template type. Options:
|
engine |
No |
String |
Cache engine: Redis. |
cache_mode |
No |
String |
DCS instance type. The value range is as follows:
|
description |
No |
String |
Template description. |
engine_version |
No |
String |
Cache version. If the cache engine is Redis, the version can be 4.0/5.0/6.0/7.0. |
params |
Yes |
Map<String,String> |
Parameter configuration. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
id |
String |
Template ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
error_code |
String |
Parameter description: Error code. Value range: For details, see Error Codes. |
error_ext_msg |
String |
Parameter description: Extended error information. This parameter is not used currently and is set to null. Value range: N/A. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
error_code |
String |
Parameter description: Error code. Value range: For details, see Error Codes. |
error_ext_msg |
String |
Parameter description: Extended error information. This parameter is not used currently and is set to null. Value range: N/A. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
error_code |
String |
Parameter description: Error code. Value range: For details, see Error Codes. |
error_ext_msg |
String |
Parameter description: Extended error information. This parameter is not used currently and is set to null. Value range: N/A. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
error_code |
String |
Parameter description: Error code. Value range: For details, see Error Codes. |
error_ext_msg |
String |
Parameter description: Extended error information. This parameter is not used currently and is set to null. Value range: N/A. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_msg |
String |
Parameter description: Error message. Value range: N/A. |
error_code |
String |
Parameter description: Error code. Value range: For details, see Error Codes. |
error_ext_msg |
String |
Parameter description: Extended error information. This parameter is not used currently and is set to null. Value range: N/A. |
Example Requests
Creating a single-node, Redis 5.0 custom template
POST https://{dcs_endpoint}/v2/{project_id}/config-templates { "name" : "Test", "cache_mode" : "single", "description" : "Test", "engine" : "Redis", "engine_version" : "5.0", "params" : { "latency-monitor-threshold" : 15 }, "template_id" : "11", "type" : "sys" }
Example Responses
Status code: 200
The custom template is created successfully.
{ "id" : "efb1ba06-d3cd-4a77-9173-16f70f2d1343" }
Status code: 400
Invalid request.
{ "error_code" : "111400063", "error_msg" : "Invalid {0} parameter in the request." }
Status Codes
Status Code |
Description |
---|---|
200 |
The custom template is created successfully. |
400 |
Invalid request. |
401 |
Invalid authentication information. |
403 |
Request rejected. |
404 |
The requested resource could not be found. |
500 |
Internal service error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.