Updated on 2022-02-22 GMT+08:00

Creating a Trigger

Function

This API is used to create a trigger.

URI

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

Table 1 describes the URI parameters.

Table 1 URI parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Project ID.

function_urn

String

Yes

Function URN. See Function Model.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

trigger_type_code

String

Yes

Trigger type.

event_type_code

String

Yes

Event type.

trigger_status

String

Yes

Trigger status. Options: ACTIVE and DISABLED.

event_data

String

Yes

Event information.

Response

Table 3 describes the response parameters.
Table 3 Response parameters

Parameter

Type

Description

trigger_id

String

Trigger ID.

trigger_type_code

String

Trigger type code.

event_type_code

String

Event type code.

trigger_status

String

Trigger status. Options: ACTIVE and DISABLED.

event_data

String

Trigger data defined in JSON format.

last_updated_time

String

Time when the trigger was last updated.

created_time

String

Time when the trigger was created.

Example

Example request

POST /v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/triggers/urn:fss:xxxxxxxxx:7aad83af3e8d42e99ac194e8419e2c9b:function:default:test:latest
{
	"trigger_type_code": "TIMER",
	"event_type_code": "MessageCreated",
	"trigger_status": "ACTIVE",
	"event_data": {
		"name": "Timer-tps7",
		"schedule_type": "Rate",
		"schedule": "3m",
		"user_event": ""
	}
}

Example response

The format of the response for a successful request is as follows:

HTTP/1.1 201 Created 
{
  "trigger_id": "be1cb36a-5efd-40ed-8376-7525bfcbe848",
  "trigger_type_code": "TIMER",
  "trigger_status": "ACTIVE",
  "event_data": {
   "name": "Timer-tps7",
   "schedule": "3m",
   "schedule_type": "Rate"
  },
  "last_updated_time": "2020-04-23T15:07:51+08:00",
  "created_time": "2020-04-23T15:07:51+08:00"
 }

The format of the response for a failed request is as follows:

HTTP/1.1 404 Not Found 
{ 
  "error_code": "FSS.1051", 
  "error_msg": "Error getting associated function" 
 }

Status Code

See Status Codes.