Adding a Trigger for an Object Instance
Function
This API is used to add a trigger for an object instance.
URI
POST Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/Object/{object_id}/Trigger
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
object_id |
Yes |
String |
Explanation Object instance ID, which can be queried by calling the API of Querying All Custom Objects (id in the response message). Constraints None Value None Default value None |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Explanation Name of the trigger to be added. Constraints None Value Start with a letter and can contain only letters, digits, and single underscores (_). The value cannot use consecutive underscore (_) and cannot end with an underscore. A maximum of 64 characters are allowed. Default value None |
label |
No |
String |
Explanation Label of the trigger to be added. Constraints None Value 1–64 characters Default value None |
description |
No |
String |
Explanation Description of the trigger. Constraints None Value 1–255 characters Default value None |
script |
Yes |
String |
Explanation Nameof the script that implements trigger functions. Constraints None Value None Default value None |
jscode |
No |
string |
Explanation JavaScript code in the trigger. Constraints None Value None Default value None |
active |
No |
String |
Explanation Whether to activate the trigger. Constraints None Value
Default value false |
event |
No |
String |
Explanation Conditions for starting a trigger. Constraints None Value
Default value None |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
resCode |
String |
Explanation Return code. Value If the request is successful, 0 is returned. For details about other error codes, see Error Codes. |
resMsg |
String |
Explanation Message returned. Value If the request is successful, "Success" is returned. In other cases, an error message is returned. |
result |
string |
Explanation If the request is successful, an ID is returned. Value None |
Example Request
POST https://Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/Object/cust000000aKtFZpERvc/Trigger { "name": "Trigger_01", "label": "Trigger 01", "description": null, "script": "string", "jscode": "Hello, world;rn", "active": true, "event": "BeforeInsert" }
Example Response
{ "resCode": "0", "resMsg": "Success", "result": "001i000000SIrEi3E0a8" }
Status Code
See Status Codes.
Error Code
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot