Help Center/ FunctionGraph/ API Reference/ APIs/ Function Triggers/ Querying All Triggers of a Function
Updated on 2026-10-27 GMT+08:00

Querying All Triggers of a Function

Function

This API is used to query all triggers of a function.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Parameter description:

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

Constraints

N/A

Value range:

32 characters, including letters and digits.

Default value:

N/A

function_urn

Yes

String

Parameter description:

URN of the function. For details, see Function Model.

Constraints

N/A

Value range:

Only letters, digits, underscores (_), hyphens (-), and colons (:) are allowed.

Default value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Parameter description:

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.

Constraints

N/A

Value range:

N/A

Default value:

N/A

Content-Type

No

String

Parameter description:

The request body type or format.

Constraints

N/A

Value range:

Only application/json is supported.

Default value:

application/json

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

[items]

Array of ListFunctionTriggerResult objects

Parameter description:

Returned body for querying the function trigger list.

Range:

None

Table 4 ListFunctionTriggerResult

Parameter

Type

Description

trigger_id

String

Parameter description:

Trigger ID.

Range:

None

trigger_type_code

String

Parameter description:

Trigger type.

Range

  • TIMER

  • CTS

  • DDS

  • DMS

  • DIS

  • LTS

  • OBS

  • SMN

  • KAFKA

  • RABBITMQ: RabbitMQ trigger.

  • DEDICATEDGATEWAY: API Gateway premium trigger.

  • OPENSOURCEKAFKA: open-source Kafka trigger.

  • APIC: ROMA Connect trigger.

  • GAUSSMONGO: GaussDB(for Mongo) trigger.

  • EVENTGRID: event bus trigger.

  • IOTDA: IoTDA trigger.

  • ROCKETMQ: RocketMQ trigger.

  • DYNAMODB: DynamoDB trigger.

trigger_status

String

Parameter description:

Trigger status.

Range

  • ACTIVE: The trigger is enabled.

  • DISABLED: The trigger is disabled.

event_data

TriggerEventDataResponseBody object

Parameter description:

Trigger attribute return body.

Range:

None

last_updated_time

String

Parameter description:

Last update time.

Range

Time

created_time

String

Parameter description:

Time when the trigger was created.

Range

Time

Table 5 TriggerEventDataResponseBody

Parameter

Type

Description

name

String

Parameter description:

Specifies the trigger name.

Range:

None

schedule_type

String

Parameter description:

Timer trigger type (timer trigger parameter).

Range

  • 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.

schedule

String

Parameter description:

Triggering rule. (timer trigger parameter).

Range

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

Parameter description:

Additional information (timer trigger parameter).

When the Timer trigger triggers function execution, the execution event (event parameter of the function) is as follows:

{"version": "v1.0",

"time": "2018-06-01T08:30:00+08:00",

"trigger_type": "TIMER",

"trigger_name": "Timer_001",

"user_event": "Additional information you entered."

Value range:

N/A

triggerid

String

Parameter description:

APIG trigger ID (APIG trigger parameter).

Range:

None

type

Integer

Parameter description:

API type (APIG trigger parameter).

Range

  • 1: Public API.

  • 2: Private API.

path

String

Parameter description:

Path of the API (APIG trigger parameter).

Range

The value must comply with the URI naming rules.

protocol

String

Parameter description:

Request protocol of the API (APIG trigger parameter).

Range

HTTP: HTTP protocol

HTTPS: HTTPS protocol

req_method

String

Parameter description:

Request mode of the API (APIG trigger parameter).

Range

GET: triggered by an HTTP GET request

POST: triggered by an HTTP POST request

PUT: triggered by an HTTP PUT request

DELETE: triggered by an HTTP DELETE request

HEAD: triggered by an HTTP HEAD request

PATCH: triggered by an HTTP PATCH request

OPTIONS: triggered by an HTTP OPTIONS request

ANY: triggered by any HTTP request

group_id

String

Parameter description:

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

Range:

None

group_name

String

Parameter description:

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

Range:

None

match_mode

String

Parameter description:

Matching mode of the API (APIG trigger parameter).

Range

  • SWA: Prefix match

  • NORMAL (default): Exact match

env_name

String

Parameter description:

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

Range:

None

env_id

String

Parameter description:

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

Range:

None

api_id

String

Parameter description:

API ID (APIG trigger parameter).

Range:

None

api_name

String

Parameter description:

API name (APIG trigger parameter).

Range:

None

auth

String

Parameter description:

Security authentication (APIG trigger parameter).

Range

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.

invoke_url

String

Parameter description:

API calling address (APIG trigger parameter).

Range:

None

func_info

ApigTriggerFuncInfo object

Parameter description:

Function backend information corresponding to the APIG trigger.

Range:

None

sl_domain

String

Parameter description:

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

Range:

None

backend_type

String

Parameter description:

Backend type of the API (APIG trigger parameter).

Range

FUNCTION

instance_id

String

Parameter description:

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

Range

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.

instance_ip

String

Parameter description:

Database IP address (DynamoDB trigger parameter).

Range:

None

table_name

String

Parameter description:

Database table name (DynamoDB trigger parameter).

Range:

None

roma_app_id

String

Parameter description:

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

Range:

None

operations

Array of strings

Parameter description:

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.

Range:

None

collection_name

String

Parameter description:

Collection name (DDS trigger parameter).

Range:

None

db_name

String

Parameter description:

Database name (DDS trigger parameter).

Range:

None

db_password

String

Parameter description:

DDS database password (DDS trigger parameter).

Range:

None

db_user

String

Parameter description:

DDS database username (DDS trigger parameter).

Range:

None

instance_addrs

Array of strings

Parameter description:

DDS database instance address (DDS trigger parameter).

Range:

None

mode

String

Parameter description:

DDS database instance type (DDS trigger parameter).

Range

Sharding: cluster instance

ReplicaSet: replica set instance

Single: single node instance

batch_size

Integer

Parameter description:

Batch size: Maximum number of data records that can be processed by the function at a time. This parameter is mandatory for DIS, DDS, Kafka, RocketMQ, and RabbitMQ triggers.

Range

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.

  • DYNAMODB trigger: Enter a value from 1 to 1,000.

queue_id

String

Parameter description:

Queue ID (DMS trigger parameter).

Range:

None

consumer_group_id

String

Parameter description:

Consumer group ID (DMS trigger parameter).

Range:

None

polling_interval

Integer

Parameter description:

Pull period.

Range:

None

stream_name

String

Parameter description:

Stream name (DIS trigger parameter).

Range:

None

sharditerator_type

String

Parameter description:

Starting position (DIS/DynamoDB trigger parameter).

Range

  • TRIM_HORIZON: Data is read from the earliest valid record 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.

polling_unit

String

Parameter description:

Pull period unit (DIS trigger parameter).

Range

  • s: second.

ms: millisecond

max_fetch_bytes

Integer

Parameter description:

Max. fetch bytes (DIS trigger parameter).

Range:

None

is_serial

String

Parameter description:

Whether to process data in serial mode (DIS trigger parameter).

Range

  • true: Data is processed in serial mode. Data is obtained only after the previous data is processed.

  • false: Data is processed in parallel mode. Data is obtained as long as the pull period arrives.

log_group_id

String

Parameter description:

Log group ID (LTS trigger parameter).

Range:

None

log_topic_id

String

Parameter description:

Log stream ID (LTS trigger parameter).

Range:

None

bucket

String

Parameter description:

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.

Range:

None

prefix

String

Parameter description:

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

Range:

None

suffix

String

Parameter description:

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

Range:

None

events

Array of strings

Parameter description:

Trigger event (OBS trigger parameter).

Range

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

Parameter description:

Topic URN (SMN trigger parameter)

Range:

None

topic_ids

Array of strings

Parameter description:

The Kafka topic ID list (Kafka trigger parameter).

Range:

None

kafka_user

String

Parameter description:

Kafka account name (Kafka trigger parameter).

Range:

None

kafka_password

String

Parameter description:

Kafka password (Kafka trigger parameter).

Range:

None

kafka_connect_address

String

Parameter description:

Kafka instance connection address (Kafka trigger parameter).

Range:

None

kafka_ssl_enable

Boolean

Parameter description:

Whether to enable security authentication (Kafka trigger parameter).

Range:

None

access_password

String

Parameter description:

RabbitMQ account password (RabbitMQ trigger parameter).

Range:

None

access_user

String

Parameter description:

RabbitMQ username (RabbitMQ trigger parameter).

Range:

None

connect_address

String

Parameter description:

Instance IP address (RabbitMQ trigger parameter).

Range:

None

exchange_name

String

Parameter description:

Switch name (RabbitMQ trigger parameter).

Range:

None

vhost

String

Parameter description:

Virtual host (RabbitMQ trigger parameter).

Range:

None

ssl_enable

Boolean

Parameter description:

Whether to enable security authentication (RabbitMQ trigger parameter).

Range

  • true: This option will be enabled.

  • false: No

enable_acl

Boolean

Parameter description:

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

Range

  • true: This option will be enabled.

false: no

access_key

String

Parameter description:

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

Range:

None

secret_key

String

Parameter description:

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

Range:

None

Table 6 ApigTriggerFuncInfo

Parameter

Type

Description

function_urn

String

Parameter description:

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

Range:

None

invocation_type

String

Parameter description:

Execution mode of a function.

Range

sync: synchronous execution

async: asynchronous execution

timeout

Integer

Parameter description:

Timeout allowed for APIG to request the FunctionGraph service. The unit is in millisecond. This parameter is mandatory for APIG triggers.

Range

1 to 60000 seconds

version

String

Parameter description:

Function version information.

Range:

None

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Query all triggers of a function.

GET https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}

Example Responses

Status code: 200

[ {
  "trigger_id" : "1b3b264db3b849118d007884b9bc8a60",
  "trigger_type_code" : "APIG",
  "trigger_status" : "ACTIVE",
  "event_data" : {
    "api_id" : "4a59f6a7263c4d1dab3f69c34f98d949",
    "api_name" : "API_test_triggers",
    "auth" : "IAM",
    "env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID",
    "env_name" : "RELEASE",
    "func_info" : {
      "function_urn" : "urn:fss:xxxxx:46b6f338fc3445b8846c71dfb1fbxxxx:function:default:test_triggers",
      "invocation_type" : "sync",
      "timeout" : 5000,
      "version" : "latest"
    },
    "group_id" : "9205f83fe721481eb490870d380cf31d",
    "group_name" : "APIGroup_2mbe",
    "invoke_url" : "https://ed94ae9494ba4f70ac24224747202140.{apig_endpoint}/test_triggers",
    "match_mode" : "SWA",
    "name" : "API_test_triggers",
    "path" : "/test_triggers",
    "protocol" : "HTTPS",
    "req_method" : "ANY",
    "triggerid" : "1b3b264db3b849118d007884b9bc8a60",
    "type" : 1
  },
  "last_updated_time" : "2022-11-09 16:37:24",
  "created_time" : "2022-11-09 16:37:24"
} ]

SDK Sample Code

The SDK sample code is as follows.

Java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.functiongraph.v2.region.FunctionGraphRegion;
import com.huaweicloud.sdk.functiongraph.v2.*;
import com.huaweicloud.sdk.functiongraph.v2.model.*;


public class ListFunctionTriggersSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        FunctionGraphClient client = FunctionGraphClient.newBuilder()
                .withCredential(auth)
                .withRegion(FunctionGraphRegion.valueOf("<YOUR REGION>"))
                .build();
        ListFunctionTriggersRequest request = new ListFunctionTriggersRequest();
        request.withFunctionUrn("{function_urn}");
        try {
            ListFunctionTriggersResponse response = client.listFunctionTriggers(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkfunctiongraph.v2.region.functiongraph_region import FunctionGraphRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkfunctiongraph.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = FunctionGraphClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(FunctionGraphRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListFunctionTriggersRequest()
        request.function_urn = "{function_urn}"
        response = client.list_function_triggers(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    functiongraph "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/functiongraph/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := functiongraph.FunctionGraphClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := functiongraph.NewFunctionGraphClient(hcClient)

    request := &model.ListFunctionTriggersRequest{}
	request.FunctionUrn = "{function_urn}"
	response, err := client.ListFunctionTriggers(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

More

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

OK

400

Bad request.

401

Unauthorized.

403

Forbidden.

404

Not found.

500

Internal server error.

Error Codes

See Error Codes.