You can call this operation to update a configuration template.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request headers

This operation uses common request headers, instead of special request headers. For more information, see the "Common request headers" section in "Common request and response headers."

Request syntax

PUT /pop/v1/wam/configTemplate HTTP/1.1

Request parameters

Parameter Type Required? Example Description
TemplateId String Yes wct-5d1eca8dd56beb2b7*****

The ID of the configuration template.

OptionSettings String No [{"path":"resources.ecs.autoScaling", "name":"instanceNum","value":"10"}, {"path":"application.option", "name":"port","value":"8081"}]

The custom configuration item data, in the format of a JSON array. The array contains the following fields:

  • path: the path to the configuration item.
  • name: the name of the configuration item.
  • value: the value of the configuration item.
TemplateDescription String No This is a template

The description of the configuration template.

Response parameters

Parameter Type Example Description
Code String OK

The response code. The value is OK if the request is successful.

ConfigTemplate

The information about the configuration template.

AppId String wa-5d1d9d8c85c7f86e2ef*****

The ID of the application to which the configuration template belongs.

AppName String app1

The name of the application to which the configuration template belongs.

CreateTime Long 1562299021581

The time when the configuration template was created.

StackId String ws-6c937c98a9c0296d0c48*****

The ID of the technology stack.

StackName String Tomcat 8.5 / Java 8 / Aliyun Linux 2.1903

The name of the technology stack.

TemplateId String wct-5d1eca8dd56beb722b7*****

The ID of the configuration template.

TemplateName String new-template-name

The name of the configuration template.

UpdateTime Long 1562587235328

The time when the configuration template was last updated.

Message String success

The response message. The value is success if the request is successful.

RequestId String CE6E878B-DDB4-4563-9263-D75057C*****

The ID of the request.

Examples

Sample request


http://webplus.cn-hangzhou.aliyuncs.com/pop/v1/wam/configTemplate?ServiceCode=webx&<Common request parameters>
{
  "TemplateId":"wct-5d1eca8dd56beb2b7*****",
  "TemplateDescription":"This is a template",
  "OptionSettings":"[{"path":"resources.ecs.autoScaling", "name":"instanceNum","value":"10"}, {"path":"application.option", "name":"port","value":"8081"}]"
}

Sample success response

XML format

<UpdateConfigTemplateResponse>
    <ConfigTemplate>
        <TemplateName>new-template-name</TemplateName>
        <StackId>ws-6c937c98a9c0296d0c48*****</StackId>
        <CreateTime>1562299021581</CreateTime>
        <AppId>wa-5d1d9d8c85c7f86e2ef*****</AppId>
        <UpdateTime>1562587235588</UpdateTime>
        <AppName>app1</AppName>
        <TemplateId>wct-5d1eca8dd56beb722b7*****</TemplateId>
        <StackName>Tomcat 8.5 / Java 8 / Aliyun Linux 2.1903</StackName>
    </ConfigTemplate>
    <Message>success</Message>
    <RequestId>733F3B46-0875-437A-9A8E-9549A0C*****</RequestId>
    <Code>OK</Code>
</UpdateConfigTemplateResponse>

JSON format

{
	"Message":"success",
	"RequestId":"10C22D0D-C353-4535-89A9-FAB5017*****",
	"ConfigTemplate":{
		"TemplateName":"new-template-name",
		"StackId":"ws-6c937c98a9c0296d0c48*****",
		"CreateTime":1562299021581,
		"AppId":"wa-5d1d9d8c85c7f86e2ef*****",
		"UpdateTime":1562587235328,
		"AppName":"app1",
		"StackName":"Tomcat 8.5 / Java 8 / Aliyun Linux 2.1903",
		"TemplateId":"wct-5d1eca8dd56beb722b7*****"
	},
	"Code":"OK"
}

Error codes

HTTP status code Error code Error message Description
404 TemplateNotExists An error occurred while updating the configuration. No corresponding configuration template instance was found. The error message returned because an error occurred while updating the configuration. No corresponding configuration template instance was found.
403 ResourceAuthFailed The specified resource does not exist or it does not belong to this Alibaba Cloud account. The error message returned because the specified resource does not exist or it does not belong to your Alibaba Cloud account.
400 StackContainsNoConfigOption An error occurred while modifying the configuration. The corresponding software stack does not contain any configuration items. The error message returned because an error occurred while updating the configuration. The specified technology stack does not contain any configuration items.
404 ConfigOptionNotExists An error occurred while updating the configuration. The system did not locate the configuration item declared by the key. The error message returned because an error occurred while updating the configuration. The system did not locate the configuration item declared by the key.
400 ChangingAReadonlyConfig An error occurred while modifying the configuration. You cannot modify a read-only configuration. The error message returned because an error occurred while updating the configuration. You cannot modify a read-only configuration item.
400 ConfigValueInvalid An error occurred while resolving the configuration values. Please make sure the value type and constraints is consistent with the declared type. Types currently supported by WebPlus are: String, Integer, List, Boolean, Float, Json. The error message returned because an error occurred while resolving the values of configuration items. Ensure that the value types of configuration items are the same as the declared value types. Currently, Web+ supports the following value types: String, Integer, List, Boolean, Float, and JSON.
404 AppPackageNotExists An application deployment package is required to create or update a deployment environment. For the first time of using WebPlus, we recommend that you use a sample project. The error message returned because you did not use a real application deployment package when creating or updating a deployment environment. If you are using Web+ for the first time, we recommend that you use the sample project.
400 AppPackageOwnedByOthers The version of the application package used must be consistent with the application to which the environment belongs. The error message returned because the deployment package version used to create or update a deployment environment for an application does not belong to the application.
400 AppNotExist A corresponding application was not found based on the application ID. The error message returned because the application of the specified ID does not exist.
404 StackNotExists The declared software stack information does not exist. The error message returned because the declared technology stack information does not exist when you create or update a deployment environment for an application.
400 AppCategoryNotMatchWithStacks The application type declared in the application does not match the type of the software stack. Please make sure that the types are consistent and then try again. The error message returned because the platform type specified for the application is different from that in the technology stack. Use a consistent platform type and try again.
400 TemplateUpdateFailed An error occurred while updating the template. The template may have been deleted, or an error may have occurred in WebPlus. The error message returned because an error occurred while updating the configuration template. The configuration template may have been deleted, or an error may have occurred in Web+.

For more information about error codes, see API Error Center.