All Products
Search
Document Center

Function Compute:UpdateTrigger

Last Updated:Dec 26, 2025

Updates a trigger.

Test

You can call this operation directly in OpenAPI Explorer. OpenAPI Explorer eliminates the need to calculate signatures and automatically generates sample code for different SDKs after a successful call.

Request headers

This operation uses only common request headers. For more information, see Common request parameters.

Name

Type

Required

Example

Description

If-Match String No e19d5cd5af0378da05f63f891c74****

Ensures that the resource you modify is the one you intend to modify. The value is from the responses of the CreateTrigger, GetTrigger, and UpdateTrigger operations.

Request syntax

PUT /services/{serviceName}/functions/{functionName}/triggers/{triggerName} HTTP/1.1

Request parameters

Name

Type

Location

Required

Example value

Description

serviceName String Path Yes service_name

The name of the service.

functionName String Path Yes function_name

The name of the function.

triggerName String Path Yes image_resize

The name of the trigger.

Object Body Yes

The definition of the trigger.

invocationRole String Body No acs:ram::1986114****4305:role/aliyunosseventnotificationrole

The role that is required by an event source, such as OSS, to invoke the function. For more information, see Introduction to triggers.

Note This parameter is not required for EventBridge triggers.
qualifier String Body No null

The version of the service. For more information, see Introduction to versions.

triggerConfig String Body No {\"payload\":\"test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}

The trigger configuration. The configuration varies based on the trigger type. For the format, see the corresponding data structure:

Response data

Name

Type

Example value

Description

ETag String 738136ea26b79cee660862cd7628****

Ensures that the modified trigger is the one you intend to modify.

createdTime String 2020-04-08T01:48:21Z

The time when the trigger was created.

invocationRole String acs:ram::19861144305****:role/aliyunosseventnotificationrole

The role that is required by an event source, such as OSS, to invoke the function. For more information, see Introduction to triggers.

lastModifiedTime String 2020-04-08T07:15:37Z

The time when the trigger was last modified.

qualifier String null

The version of the service. For more information, see Introduction to versions.

sourceArn String acs:oss:cn-shanghai:12345:mybucket

The Alibaba Cloud Resource Name (ARN) of the event source.

triggerConfig String {\"payload\":\"test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}

The trigger configuration. The configuration varies based on the trigger type.

triggerName String trigger_name

The name of the trigger.

triggerType String oss

The type of the trigger. The following list describes the valid values and the corresponding trigger types:

Examples

Request example

PUT /services/service_name/functions/function_name/triggers/image_resize HTTP/1.1
Host:fc-ram.aliyuncs.com
If-Match:e19d5cd5af0378da05f63f891c74****
Content-Type:application/json

{
  "invocationRole" : "acs:ram::1986114****4305:role/aliyunosseventnotificationrole",
  "qualifier" : "null",
  "triggerConfig" : "{\"payload\":\"test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}"
}

Response example

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<UpdateTriggerResponse>
    <createdTime>2020-04-08T01:48:21Z</createdTime>
    <invocationRole>acs:ram::19861144305****:role/aliyunosseventnotificationrole</invocationRole>
    <lastModifiedTime>2020-04-08T07:15:37Z</lastModifiedTime>
    <qualifier>null</qualifier>
    <sourceArn>acs:oss:cn-shanghai:12345:mybucket</sourceArn>
    <triggerConfig>{\"payload\":\"test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}</triggerConfig>
    <triggerName>trigger_name</triggerName>
    <triggerType>oss</triggerType>
</UpdateTriggerResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "createdTime" : "2020-04-08T01:48:21Z",
  "invocationRole" : "acs:ram::19861144305****:role/aliyunosseventnotificationrole",
  "lastModifiedTime" : "2020-04-08T07:15:37Z",
  "qualifier" : "null",
  "sourceArn" : "acs:oss:cn-shanghai:12345:mybucket",
  "triggerConfig" : "{\"payload\":\"test demo\",\"cronExpression\":\"@every 4m\",\"enable\":true}",
  "triggerName" : "trigger_name",
  "triggerType" : "oss"
}

Error codes

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