Updated on 2025-08-30 GMT+08:00

Creating a Trigger

Function

This API is used to create a trigger.

  • The following types of triggers are supported: timer, API Gateway (Dedicated), APIC, CTS, DDS, GeminiDB Mongo, DIS, LTS, OBS, SMN, KAFKA, Kafka (Open-Source), DMS (for RabbitMQ), IoTDA, EG, and DMS (for RocketMQ).
  • By default, DDS and Kafka triggers are in the DISABLED state, and other triggers are in the ACTIVE state.
  • Only Timer, DDS, LTS, and Kafka triggers can be disabled.

URI

POST /v2/{project_id}/fgs/triggers/{function_urn}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

function_urn

Yes

String

Function URN. For details, see the function model descriptions.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Content-Type

Yes

String

Message body type or format.

Default value: application/json

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

trigger_type_code

Yes

String

Trigger type.

  • TIMER
  • APIC: API Connect (APIC) (only available in AP-Singapore)
  • DEDICATEDGATEWAY: API Gateway (Dedicated)
  • CTS: Cloud Trace Service (CTS): Enable CTS first. (available in CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, ME-Riyadh, TR-Istanbul, LA-Mexico City2, and LA-Sao Paulo1)
  • DDS: Document Database Service (DDS): Configure a VPC for the function first. (available in CN North-Beijing4, CN East-Shanghai1, and CN-Hong Kong)
  • DMS: Distributed Message Service (DMS)
  • GAUSSMONGO: GeminiDB Mongo (available in CN North-Beijing4, CN East-Shanghai1, and AP-Singapore)
  • DIS: Data Ingestion Service (DIS) (available in CN East-Shanghai1, CN-Hong Kong, and AP-Singapore)
  • LTS: Log Tank Service (LTS): Configure an LTS agency first. (available at all regions except LA-Sao Paulo1)
  • KAFKA: DMS (for Kafka): Configure a DMS agency first. (available at all regions except LA-Sao Paulo1)
  • OBS: Object Storage Service (OBS) (available at CN-Hong Kong, AP-Bangkok, AP-Singapore, AP-Jakarta, TR-Istanbul, and LA-Mexico City2)
  • SMN: Simple Message Notification (SMN) (available at CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, TR-Istanbul, LA-Sao Paulo1, and LA-Santiago)
  • OPENSOURCEKAFKA: Kafka (Open-Source) (available at CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, and LA-Santiago)
  • RABBITMQ: DMS (for RabbitMQ): Configure a DMS agency first. (available at CN North-Beijing4, CN East-Shanghai1, AP-Bangkok, AP-Singapore, LA-Mexico City2, and LA-Sao Paulo1)
  • IOTDA: IoT Device Access (IoTDA) (available at CN North-Beijing4, CN-Hong Kong, and AP-Bangkok)
  • EVENTGRID: EventGrid (EG) (available at AP-Bangkok, AP-Singapore, AF-Johannesburg, LA-Mexico City2, and LA-Santiago)
  • ROCKETMQ: Distributed Message Service (DMS) for RocketMQ

trigger_status

No

String

Trigger status.

Enumerated values:

  • ACTIVE
  • DISABLED

event_type_code

No

String

Message code.

event_data

Yes

TriggerEventDataRequestBody object

Trigger source event.

Table 4 TriggerEventDataRequestBody

Parameter

Mandatory

Type

Description

name

No

String

  • Timer trigger: trigger name
  • APIG trigger: API name
  • CTS trigger: notification name
  • OBS trigger: event notification name. The default value is the trigger ID.

schedule_type

No

String

Timer trigger type (timer trigger parameter). This parameter is mandatory for timer triggers.

  • Rate: specifies the frequency (minutes, hours, or days) at which the function is invoked. If the unit is minute, the value cannot exceed 60. If the unit is hour, the value cannot exceed 24. If the unit is day, the value cannot exceed 30.
  • Cron: specifies a Cron expression to periodically invoke a function.

Enumerated values:

  • Rate
  • Cron

schedule

No

String

Triggering rule (timer trigger parameter). This parameter is mandatory for timer triggers.

  • When the trigger type is Rate, the scheduled rule is used.
  • When the trigger type is Cron, the Cron expression is used.

user_event

No

String

Additional information (timer trigger parameter). When the timer trigger triggers the function, the execution event (the event parameter of the function) is {"version": "v1.0", "time": "2018-06-01T08:30:00+08:00", "trigger_type": "TIMER", "trigger_name": "Timer_001", "user_event": "Additional information you entered"}.

type

No

Integer

API type (APIG trigger parameter). This parameter is mandatory for APIG triggers.

  • 1: public
  • 2: private

path

No

String

Path of the API (APIG trigger parameter). This parameter is mandatory for APIG triggers.

protocol

No

String

Request protocol of the API (APIG trigger parameter). This parameter is mandatory for APIG triggers.

Enumerated values:

  • HTTP
  • HTTPS

req_method

No

String

Request method of the API (APIG trigger parameter). This parameter is mandatory for APIG triggers.

Enumerated values:

  • GET
  • POST
  • PUT
  • DELETE
  • HEAD
  • PATCH
  • OPTIONS
  • ANY

group_id

No

String

ID of the group to which the API belongs (APIG trigger parameter). This parameter is mandatory for APIG triggers.

group_name

No

String

Name of the group to which the API belongs

match_mode

No

String

Matching mode of the API (APIG trigger parameter). This parameter is mandatory for APIG triggers.

  • SWA: prefix match
  • NORMAL: exact match

Enumerated values:

  • SWA
  • NORMAL

env_name

No

String

Environment in which the API is published (APIG trigger parameter). This parameter is mandatory for APIG triggers.

env_id

No

String

ID of the environment in which the API is published (APIG trigger parameter). This parameter is mandatory for APIG triggers.

auth

No

String

API authentication mode (APIG trigger parameter). This parameter is mandatory for APIG triggers.

  • IAM: IAM authentication. This mode grants access permissions to IAM users only and is of medium security.
  • APP: AppKey and AppSecret authentication. This mode is of high security and is recommended.
  • NONE: Authentication is not required. All users can access this API. This mode is not recommended.

Enumerated values:

  • IAM
  • APP
  • NONE

func_info

No

ApigTriggerFuncInfo object

FunctionGraph backend details (APIG trigger parameter). This parameter is mandatory for APIG triggers.

sl_domain

No

String

Subdomain name allocated by the APIG system by default (APIG trigger parameter).

Minimum length: 1

Maximum length: 255

backend_type

No

String

API backend type (APIG trigger parameter).

Enumerated values:

  • FUNCTION

operations

No

Array of strings

Custom operations (CTS trigger parameter). This parameter is mandatory for CTS triggers. CTS collects operation records of subscribed cloud resources. If you create a function with a CTS trigger, collected operation records of specified cloud services will be passed as a parameter to invoke the function.

instance_id

No

String

Instance ID. This parameter is mandatory for DDS, RabbitMQ, and RocketMQ and Kafka triggers.

  • APIG trigger: APIG gateway ID.
  • DDS trigger: DDS instance ID.
  • Kafka trigger: Kafka instance ID.
  • RabbitMQ trigger: RabbitMQ instance ID.
  • RocketMQ trigger: RocketMQ instance ID.

collection_name

No

String

Collection name (DDS trigger parameter). This parameter is mandatory for DDS triggers.

db_name

No

String

Database name (DDS trigger parameter). This parameter is mandatory for DDS triggers.

db_password

No

String

Database password (DDS trigger parameter). This parameter is mandatory for DDS triggers.

batch_size

No

Integer

Batch size, that is, the maximum amount of data that can be processed at a time. This parameter is mandatory for DIS, DDS, Kafka, RocketMQ, and RabbitMQ triggers.

  • DDS trigger: Enter a value from 1 to 10,000.
  • DIS trigger: Enter a value from 1 to 10,000.
  • Kafka trigger: Enter a value from 1 to 1,000.
  • RabbitMQ trigger: Enter a value from 1 to 1,000.
  • RocketMQ trigger: Enter a value from 1 to 1,000.

queue_id

No

String

Queue ID (DMS trigger parameter). This parameter is mandatory for DMS triggers.

consumer_group_id

No

String

Consumer group ID (DMS trigger parameter). This parameter is mandatory for DMS triggers.

polling_interval

No

Integer

Pull period. This parameter is mandatory for DIS and DMS triggers.

stream_name

No

String

Stream name (DIS trigger parameter). This parameter is mandatory for DIS triggers.

sharditerator_type

No

String

Starting position (DIS trigger parameter). This parameter is mandatory for DIS triggers.

  • TRIM_HORIZON: Data is read from the earliest valid records that are stored in the partition.
  • LATEST: Data is read from the latest record in the partition. This option ensures that the most recent data in the partition is read.

Enumerated values:

  • TRIM_HORIZON
  • LATEST

polling_unit

No

String

Pull period unit (DIS trigger parameter). This parameter is mandatory for DIS triggers.

  • s: second
  • ms indicates the millisecond.

Enumerated values:

  • s
  • ms

max_fetch_bytes

No

Integer

Max. fetch bytes (DIS trigger parameter).

Minimum value: 0

Maximum value: 4194304

is_serial

No

String

Serial data processing (DIS trigger parameter): If this option is selected, FunctionGraph pulls data from the stream only after previous data is processed. If this option is not selected, FunctionGraph pulls data from the stream as long as the pull period ends. This parameter is mandatory for DIS triggers.

Enumerated values:

  • true
  • false

log_group_id

No

String

Log group ID (LTS trigger parameter). This parameter is mandatory for LTS triggers.

log_topic_id

No

String

Log stream ID (LTS trigger parameter). This parameter is mandatory for LTS triggers.

bucket

No

String

Bucket name (OBS trigger parameter). The name of the OBS bucket used as the event source cannot be the same as that of an existing bucket of the current user or another user. After being created, the bucket name cannot be modified. This parameter is mandatory for OBS triggers.

Minimum length: 1

Maximum length: 64

prefix

No

String

Prefix (OBS trigger parameter). Enter a prefix to limit notifications to objects whose names start with the matching characters.

Minimum length: 0

Maximum length: 1024

suffix

No

String

Suffix (OBS trigger parameter). Enter a suffix to limit notifications to objects whose names end with the matching characters.

Minimum length: 0

Maximum length: 1024

events

No

Array of strings

Events (OBS trigger parameter). This parameter is mandatory for OBS triggers.

  • ObjectCreated: all kinds of object creation operations, including PUT, POST, COPY, and part assembling
  • Put: object upload using PUT
  • Post: object upload using POST
  • Copy: object copying using COPY
  • CompleteMultipartUpload: Assemble parts in a multipart upload.
  • ObjectRemoved: deleting objects
  • Delete: object deletion with a version ID specified
  • DeleteMarkerCreated: object deletion with no version ID specified

topic_urn

No

String

Topic URN (SMN trigger parameter) This parameter is mandatory for SMN triggers.

Minimum length: 1

Maximum length: 255

topic_ids

No

Array of strings

The Kafka topic ID list (Kafka trigger parameter). This parameter is mandatory for Kafka triggers.

kafka_user

No

String

Kafka account name (Kafka trigger parameter).

kafka_password

No

String

Kafka account password (Kafka trigger parameter).

kafka_connect_address

No

String

Kafka instance connection address (Kafka trigger parameter).

kafka_ssl_enable

No

Boolean

Whether to enable security authentication (Kafka trigger parameter).

access_password

No

String

RabbitMQ account password (RabbitMQ trigger parameter). This parameter is mandatory for RabbitMQ triggers.

access_user

No

String

RabbitMQ account name (RabbitMQ trigger parameter).

connect_address

No

String

Instance connection IP address (RabbitMQ trigger parameter).

exchange_name

No

String

Exchange name (RabbitMQ trigger parameter). This parameter is mandatory for RabbitMQ triggers.

vhost

No

String

Virtual host (RabbitMQ trigger parameter).

ssl_enable

No

Boolean

Whether to enable security authentication (RabbitMQ trigger parameter).

enable_acl

No

Boolean

Whether to enable username and password authentication (RocketMQ trigger parameter).

access_key

No

String

Connection username (RocketMQ trigger parameter). This parameter is mandatory when enable_acl is set to true.

secret_key

No

String

Connection password (RocketMQ trigger parameter). This parameter is mandatory when enable_acl is set to true.

Table 5 ApigTriggerFuncInfo

Parameter

Mandatory

Type

Description

function_urn

No

String

Function URN. For details, see the function model descriptions.

invocation_type

No

String

Execution mode of a function.

  • sync: synchronous execution
  • async: asynchronous execution

Enumerated values:

  • sync
  • async

timeout

Yes

Integer

Timeout allowed for APIG to request the FunctionGraph service. Unit: millisecond. This parameter is mandatory for APIG triggers.

Minimum value: 1

Maximum value: 60000

version

No

String

Function version information.

Response Parameters

Status code: 201

Table 6 Response body parameters

Parameter

Type

Description

trigger_id

String

Trigger ID.

trigger_type_code

String

Trigger type.

  • TIMER
  • APIC: API Connect (APIC) (only available in AP-Singapore)
  • DEDICATEDGATEWAY: API Gateway (Dedicated)
  • CTS: Cloud Trace Service (CTS) (available in CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, ME-Riyadh, TR-Istanbul, LA-Mexico City2, and LA-Sao Paulo1)
  • DDS: Document Database Service (DDS) (available in CN North-Beijing4, CN East-Shanghai1, and CN-Hong Kong)
  • DMS: Distributed Message Service (DMS)
  • GAUSSMONGO: GeminiDB Mongo (available in CN North-Beijing4, CN East-Shanghai1, and AP-Singapore)
  • DIS: Data Ingestion Service (DIS) (available in CN East-Shanghai1, CN-Hong Kong, and AP-Singapore)
  • LTS: Log Tank Service (LTS) (available at all regions except LA-Sao Paulo1)
  • KAFKA: DMS (for Kafka) (available at all regions except LA-Sao Paulo1)
  • OBS: Object Storage Service (OBS) (available at CN-Hong Kong, AP-Bangkok, AP-Singapore, AP-Jakarta, TR-Istanbul, and LA-Mexico City2)
  • SMN: Simple Message Notification (SMN) (available at CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, TR-Istanbul, LA-Sao Paulo1, and LA-Santiago)
  • OPENSOURCEKAFKA: Kafka (Open-Source) (available at CN North-Beijing4, CN East-Shanghai1, CN-Hong Kong, AP-Bangkok, AP-Singapore, and LA-Santiago)
  • RABBITMQ: DMS (for RabbitMQ) (available at CN North-Beijing4, CN East-Shanghai1, AP-Bangkok, AP-Singapore, LA-Mexico City2, and LA-Sao Paulo1)
  • IOTDA: IoT Device Access (IoTDA) (available at CN North-Beijing4, CN-Hong Kong, and AP-Bangkok)
  • EVENTGRID: EventGrid (EG) (available at AP-Bangkok, AP-Singapore, AF-Johannesburg, LA-Mexico City2, and LA-Santiago)
  • ROCKETMQ: Distributed Message Service (DMS) for RocketMQ

trigger_status

String

Trigger status.

  • ACTIVE: The trigger is enabled.
  • DISABLED: The trigger is disabled.

Enumerated values:

  • ACTIVE
  • DISABLED

event_data

TriggerEventDataResponseBody object

Trigger source event.

last_updated_time

String

Time when the trigger was last updated.

created_time

String

Time when the trigger was created.

Table 7 TriggerEventDataResponseBody

Parameter

Type

Description

name

String

Trigger name.

schedule_type

String

Timer trigger type (timer trigger parameter).

  • Rate: specifies the frequency (minutes, hours, or days) at which the function is invoked. If the unit is minute, the value cannot exceed 60. If the unit is hour, the value cannot exceed 24. If the unit is day, the value cannot exceed 30.
  • Cron: specifies a Cron expression to periodically invoke a function.

Enumerated values:

  • Rate
  • Cron

schedule

String

Triggering rule (timer trigger parameter).

  • When the trigger type is Rate, the scheduled rule is used.
  • When the trigger type is Cron, the Cron expression is used.

user_event

String

Additional information (timer trigger parameter). When the timer trigger triggers the function, the execution event (the event parameter of the function) is {"version": "v1.0", "time": "2018-06-01T08:30:00+08:00", "trigger_type": "TIMER", "trigger_name": "Timer_001", "user_event": "Additional information you entered"}.

triggerid

String

APIG trigger ID (APIG trigger parameter).

type

Integer

API type (APIG trigger parameter).

  • 1: public
  • 2: private

path

String

Path of the API (APIG trigger parameter).

protocol

String

Request protocol of the API (APIG trigger parameter).

Enumerated values:

  • HTTP
  • HTTPS

req_method

String

Request method of the API (APIG trigger parameter).

Enumerated values:

  • GET
  • POST
  • PUT
  • DELETE
  • HEAD
  • PATCH
  • OPTIONS
  • ANY

group_id

String

ID of the group to which the API belongs (APIG trigger parameter).

group_name

String

Name of the group to which the API belongs (APIG trigger parameter).

match_mode

String

Matching mode of the API (APIG trigger parameter).

  • SWA: prefix match
  • NORMAL: exact match

Enumerated values:

  • SWA
  • NORMAL

env_name

String

Environment in which the API is published (APIG trigger parameter).

env_id

String

ID of the environment in which the API is published (APIG trigger parameter).

api_id

String

API ID (APIG trigger parameter).

api_name

String

API name (APIG trigger parameter).

auth

String

API authentication mode (APIG trigger parameter).

  • IAM: IAM authentication. This mode grants access permissions to IAM users only and is of medium security.
  • APP: AppKey and AppSecret authentication. This mode is of high security and is recommended.
  • NONE: Authentication is not required. All users can access this API. This mode is not recommended.

Enumerated values:

  • IAM
  • APP
  • NONE

invoke_url

String

API calling address (APIG trigger parameter).

func_info

ApigTriggerFuncInfo object

FunctionGraph backend details (APIG trigger parameter). This parameter is mandatory for APIG triggers.

sl_domain

String

Subdomain name allocated by the APIG system by default (APIG trigger parameter).

Minimum length: 1

Maximum length: 255

backend_type

String

API backend type (APIG trigger parameter).

Enumerated values:

  • FUNCTION

instance_id

String

Instance ID. This parameter is mandatory for DDS, RabbitMQ, and RocketMQ and Kafka triggers.

  • APIG trigger: APIG gateway ID.
  • DDS trigger: DDS instance ID.
  • Kafka trigger: Kafka instance ID.
  • RabbitMQ trigger: RabbitMQ instance ID.
  • RocketMQ trigger: RocketMQ instance ID.

roma_app_id

String

ID of the integration application to which the API belongs (APIG trigger parameter).

operations

Array of strings

Custom operations (CTS trigger parameter). CTS collects operation records of subscribed cloud resources. If you create a function with a CTS trigger, collected operation records of specified cloud services will be passed as a parameter to invoke the function.

collection_name

String

Collection name (DDS trigger parameter).

db_name

String

Database name (DDS trigger parameter).

db_password

String

Database password (DDS trigger parameter).

db_user

String

Database username (DDS trigger parameter).

instance_addrs

Array of strings

Database instance address (DDS trigger parameter).

mode

String

Database instance type (DDS trigger parameter).

  • Sharding: cluster instance
  • ReplicaSet: replica set instance
  • Single: single node instance

batch_size

Integer

Batch size, that is, the maximum amount of data that can be processed at a time. This parameter is mandatory for DIS, DDS, Kafka, RocketMQ, and RabbitMQ triggers.

  • DDS trigger: Enter a value from 1 to 10,000.
  • DIS trigger: Enter a value from 1 to 10,000.
  • Kafka trigger: Enter a value from 1 to 1,000.
  • RabbitMQ trigger: Enter a value from 1 to 1,000.
  • RocketMQ trigger: Enter a value from 1 to 1,000.

queue_id

String

Queue ID (DMS trigger parameter).

consumer_group_id

String

Consumer group ID (DMS trigger parameter).

polling_interval

Integer

Pull period.

stream_name

String

Stream name (DIS trigger parameter).

sharditerator_type

String

Starting position (DIS trigger parameter).

  • TRIM_HORIZON: Data is read from the earliest valid records that are stored in the partition.
  • LATEST: Data is read from the latest record in the partition. This option ensures that the most recent data in the partition is read.

Enumerated values:

  • TRIM_HORIZON
  • LATEST

polling_unit

String

Pull period unit (DIS trigger parameter).

  • s: second
  • ms indicates the millisecond.

Enumerated values:

  • s
  • ms

max_fetch_bytes

Integer

Max. fetch bytes (DIS trigger parameter).

Minimum value: 0

Maximum value: 4194304

is_serial

String

Serial data processing (DIS trigger parameter): If this option is selected, FunctionGraph pulls data from the stream only after previous data is processed. If this option is not selected, FunctionGraph pulls data from the stream as long as the pull period ends.

Enumerated values:

  • true
  • false

log_group_id

String

Log group ID (LTS trigger parameter).

log_topic_id

String

Log stream ID (LTS trigger parameter).

bucket

String

Bucket name (OBS trigger parameter). The name of the OBS bucket used as the event source cannot be the same as that of an existing bucket of the current user or another user. After being created, the bucket name cannot be modified.

Minimum length: 1

Maximum length: 64

prefix

String

Prefix (OBS trigger parameter). Enter a prefix to limit notifications to objects whose names start with the matching characters.

Minimum length: 0

Maximum length: 1024

suffix

String

Suffix (OBS trigger parameter). Enter a suffix to limit notifications to objects whose names end with the matching characters.

Minimum length: 0

Maximum length: 1024

events

Array of strings

Events (OBS trigger parameter).

  • ObjectCreated: all kinds of object creation operations, including PUT, POST, COPY, and part assembling
  • Put: object upload using PUT
  • Post: object upload using POST
  • Copy: object copying using COPY
  • CompleteMultipartUpload: Assemble parts in a multipart upload.
  • ObjectRemoved: deleting objects
  • Delete: object deletion with a version ID specified
  • DeleteMarkerCreated: object deletion with no version ID specified

topic_urn

String

Topic URN (SMN trigger parameter)

Minimum length: 1

Maximum length: 255

topic_ids

Array of strings

The Kafka topic ID list (Kafka trigger parameter).

kafka_user

String

Kafka account name (Kafka trigger parameter).

kafka_password

String

Kafka account password (Kafka trigger parameter).

kafka_connect_address

String

Kafka instance connection address (Kafka trigger parameter).

kafka_ssl_enable

Boolean

Whether to enable security authentication (Kafka trigger parameter).

access_password

String

RabbitMQ account password (RabbitMQ trigger parameter).

access_user

String

RabbitMQ account name (RabbitMQ trigger parameter).

connect_address

String

Instance connection IP address (RabbitMQ trigger parameter).

exchange_name

String

Exchange name (RabbitMQ trigger parameter).

vhost

String

Virtual host (RabbitMQ trigger parameter).

ssl_enable

Boolean

Whether to enable security authentication (RabbitMQ trigger parameter).

enable_acl

Boolean

Explanation

Whether to enable username and password authentication (RocketMQ trigger parameter).

Value range

  • true: yes

  • false: no

access_key

String

Explanation

Connection username (RocketMQ trigger parameter). This parameter is mandatory when enable_acl is set to true.

Value range

None

secret_key

String

Explanation

Connection password (RocketMQ trigger parameter). This parameter is mandatory when enable_acl is set to true.

Value range

None

Table 8 ApigTriggerFuncInfo

Parameter

Type

Description

function_urn

String

Function URN. For details, see the function model descriptions.

invocation_type

String

Execution mode of a function.

  • sync: synchronous execution
  • async: asynchronous execution

Enumerated values:

  • sync
  • async

timeout

Integer

Timeout allowed for APIG to request the FunctionGraph service. Unit: millisecond. This parameter is mandatory for APIG triggers.

Minimum value: 1

Maximum value: 60000

version

String

Function version information.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

  • Create an OBS trigger named obs-event-1ec7 with events of uploading files to the input-picture2 bucket.
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "OBS",
      "trigger_status" : "ACTIVE",
      "event_data" : {
        "bucket" : "input-picture2",
        "events" : [ "s3:ObjectCreated:*" ],
        "name" : "obs-event-1ec7"
      }
    }
  • Create a dedicated APIG trigger named API_test_function, with None authentication (temporary domain name) and 5000s timeout.
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "DEDICATEDGATEWAY",
      "trigger_status" : "ACTIVE",
      "event_data" : {
        "func_info" : {
          "timeout" : 5000
        },
        "name" : "API_test_function",
        "env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
        "env_name" : "RELEASE",
        "protocol" : "HTTPS",
        "auth" : "IAM",
        "group_id" : "5106210cf79e4xxxx",
        "sl_domain" : "5106210cf79e4xxxx.apic.{region_id}.example.com",
        "match_mode" : "SWA",
        "req_method" : "ANY",
        "backend_type" : "FUNCTION",
        "type" : 1,
        "path" : "/test_gxz_v1_billing"
      }
    }
  • Create a Kafka trigger named 86ad3efcxx to pull messages from the PUSH_TOKEN_RECORD consumer group.
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "KAFKA",
      "trigger_status" : "DISABLED",
      "event_data" : {
        "instance_id" : "86ad3efc-c019-460e-91e7-317b1a89f95x",
        "topic_ids" : [ "PUSH_TOKEN_RECORD" ],
        "batch_size" : 100
      }
    }
  • Create a timer trigger to trigger a function every 3 minutes.
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "TIMER",
      "trigger_status" : "ACTIVE",
      "event_data" : {
        "name" : "Timer-l8v2",
        "schedule" : "3m",
        "schedule_type" : "Rate"
      }
    }
  • Create an LTS trigger. (An agency with LTS permissions is required.)
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "LTS",
      "trigger_status" : "ACTIVE",
      "event_data" : {
        "log_group_id" : "ccd3fa30-7c86-4590-8a9d-XXX",
        "log_topic_id" : "5b4944dd-9603-481d-9b91-XXX"
      }
    }
  • Create an SMN trigger.
    POST https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    
    {
      "trigger_type_code" : "SMN",
      "trigger_status" : "ACTIVE",
      "event_data" : {
        "topic_urn" : "urn:smn:{region}:{project_id}:Failed_times"
      }
    }

Example Responses

Status code: 201

Created

{
  "trigger_id" : "9a14fae1-78cf-4185-ac7a-429eb6dc41fb",
  "trigger_type_code" : "TIMER",
  "trigger_status" : "ACTIVE",
  "event_data" : {
    "name" : "Timer-cpg3",
    "schedule" : "3m",
    "schedule_type" : "Rate"
  },
  "last_updated_time" : "2022-11-09 16:37:24",
  "created_time" : "2022-11-09 16:37:24"
}

Status Codes

Status Code

Description

201

Created

400

Bad request.

401

Unauthorized.

403

Forbidden.

404

Not found.

500

Internal server error.

Error Codes

See Error Codes.