tencent cloud

Serverless Cloud Function

CreateTrigger

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-10-13 15:53:11

1. API Description

Domain name for API request: scf.intl.tencentcloudapi.com.

This API is used to set up alarms for the new trigger mode based on parameters.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateTrigger.
Version Yes String Common Params. The value used for this API: 2018-04-16.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
FunctionName Yes String Function name bound to the created trigger
TriggerName Yes String Name of the trigger to create. If it is a scheduled trigger, the name supports English letters, digits, hyphens, and underscores, up to 100 characters. If it is a COS trigger, it must be the access domain of the corresponding COS storage bucket suitable for the XML API (for example, 5401-5ff414-12345.cos.ap-shanghai.myqcloud.com). For other triggers, see the parameter description of the specific trigger binding.
Type Yes String Trigger type. Currently supports cos, cls, timer, ckafka, and http types. To create a function URL, please use the http type. See Creating a Function URL. To create a cls trigger, see CLS Creating Delivery SCF Task.
TriggerDesc No String Parameters corresponding to the trigger. For details, see Trigger Description.
Namespace No String Namespace of the function
Qualifier No String Version or alias that the trigger takes effect on. It is recommended to fill in $DEFAULT for future grayscale release. Default value: $LATEST.
Enable No String Initial status of the trigger. OPEN means enabling, and CLOSE means disabling.
CustomArgument No String User-defined parameter. Only timer triggers are supported.
Description No String Trigger description.

3. Output Parameters

Parameter Name Type Description
TriggerInfo Trigger Trigger information.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Create a New Trigger

User uses this function to create a trigger.

Input Example

https://scf.intl.tencentcloudapi.com/?Action=CreateTrigger
&FunctionName=<FunctionName>
&TriggerName=<TriggerName>
&Type=timer
&TriggerDesc=*/2****
&<Common request parameters>

Output Example

{
    "Response": {
        "TriggerInfo": {
            "AddTime": "2021-06-09 16:07:18",
            "AvailableStatus": "Available",
            "BindStatus": "on",
            "CustomArgument": "",
            "Description": "",
            "Enable": 0,
            "ModTime": "2021-08-31 21:45:32",
            "Qualifier": "$DEFAULT",
            "ResourceId": "XXX",
            "TriggerAttribute": "single",
            "TriggerDesc": "{\"cron\":\"0 */2 * * * * *\"}",
            "TriggerName": "TriggerName",
            "Type": "timer"
        },
        "RequestId": "eac6b301-a322-493a-8e36-83b295459397"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.ApiGateway Failed to create the API Gateway trigger.
FailedOperation.Apigw Failed to create the trigger.
FailedOperation.Cos Failed to manipulate COS resources.
FailedOperation.CreateTrigger The function status currently does not allow this operation.
InternalError.ApiGateway Internal error occurred while creating an apigw trigger.
InternalError.Ckafka ckafka interface failure.
InternalError.Cmq Failed to delete the cmq Trigger.
InternalError.Cos Failed to update the trigger.
InternalError.System Internal system error.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.ApiGateway ApiGateway parameter error.
InvalidParameterValue.Cdn Cdn input error.
InvalidParameterValue.Ckafka Ckafka input error.
InvalidParameterValue.Cos Cos input error.
InvalidParameterValue.CosNotifyRuleConflict COS notification rule conflict.
InvalidParameterValue.CustomArgument CustomArgument parameter length exceeds the limit.
InvalidParameterValue.Description Invalid Description.
InvalidParameterValue.EASConfig EASConfig parameters are abnormal.
InvalidParameterValue.Enable The Enable value does not conform to the specification. Fix it and try again.
InvalidParameterValue.FunctionName The function does not exist.
InvalidParameterValue.SecretInfo SecretInfo error.
InvalidParameterValue.ServiceName ServiceName is not named properly.
InvalidParameterValue.TriggerDesc TriggerDesc input parameter error.
InvalidParameterValue.TriggerName TriggerName input error.
InvalidParameterValue.Type Type input error.
InvalidParameterValue.ZipFile A non-standard zip file is detected. Recompress the file and try again.
LimitExceeded.Cdn Cdn usage exceeds the maximum limit.
LimitExceeded.FunctionOnTopic Functions under the same topic exceed the maximum limit.
LimitExceeded.Trigger The number of triggers exceeds the maximum limit. You can submit a ticket (https://www.tencentcloud.com/act/event/Online_service?from=scf%7Cindex?from_cn_redirect=1) to apply for a limit increase.
ResourceInUse The resource is occupied.
ResourceInUse.Cdn Cdn is occupied.
ResourceInUse.Cmq Cmq is occupied.
ResourceInUse.Cos Cos is occupied.
ResourceInUse.Trigger TriggerName already exists.
ResourceInUse.TriggerName TriggerName already exists.
ResourceInsufficient.COS Insufficient COS resources.
ResourceNotFound The resource does not exist.
ResourceNotFound.Cdn Cdn does not exist.
ResourceNotFound.Ckafka Ckafka does not exist.
ResourceNotFound.Cmq Cmq does not exist.
ResourceNotFound.Cos Cos does not exist.
ResourceNotFound.Function Function does not exist.
ResourceNotFound.FunctionName Function does not exist.
ResourceNotFound.FunctionVersion The function version does not exist.
ResourceNotFound.Namespace Namespace does not exist.
ResourceNotFound.Qualifier The version does not exist.
ResourceNotFound.Version The version does not exist.
UnauthorizedOperation Unauthorized operation.
UnauthorizedOperation.CAM CAM authentication failed.
UnauthorizedOperation.CreateTrigger No permissions.
UnsupportedOperation The operation is not supported.
UnsupportedOperation.Cdn Cdn is not supported.
UnsupportedOperation.Cos The Cos operation is not supported.
UnsupportedOperation.Trigger The Trigger operation is not supported.

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백