Trigger Endpoints
The following are the methods currently implemented for the trigger resources of the designer in the ProcessMaker API.
Trigger resources:
Name | Description | Type | Value |
---|---|---|---|
tri_uid | Trigger UID | String | String |
tri_title | Trigger name | String | "Trigger name" (string) |
tri_description | Trigger description | String | "Trigger Description" (Alphanumeric String) |
tri_webbot | Trigger code | String | "die('The End.');" (php code) |
tri_param | Initial parameters of the trigger | String | "a:2: {i:0;s:5:dato1";i:1.s:5:"dato2";}" (serialized string) |
Information about each method is written in the sections below:
Get Triggers List: GET project/{prj_uid}/triggers
Gets a list of triggers in a project.
GET /api/1.0/{workspace}/project/{prj_uid}/triggers
Parameters:
-
Name Type Description workspace String Workspace name prj_uid String Project UID
Result:
-
Type Description array Returns an array of objects with the existent triggers
Example:
Response
Content-Type: application/json
[
{
"tri_uid": "56812777252a6313aa8cba2043861472",
"tri_title": "Trigger #1",
"tri_description": "Trigger #1 - Desc",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
},
{
"tri_uid": "59737921052a5d667689400022387588",
"tri_title": "Trigger #2",
"tri_description": "Trigger #2 - Desc",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
}
]
Get Trigger GET project/{prj_uid}/trigger/{tri_uid}
Gets a single trigger in a project.
GET /api/1.0/{workspace}/project/{prj_uid}/trigger/{tri_uid}
Parameters:
-
Name Type Description workspace String Workspace name prj_uid String Project UID tri_uid String Trigger UID
Result:
-
Type Description array Returns a trigger object
Example:
Response
Content-Type: application/json
{
"tri_uid": "56812777252a6313aa8cba2043861472",
"tri_title": "Trigger #1",
"tri_description": "Trigger #1 - Desc",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
}
Create Trigger: POST project/{prj_uid}/trigger
Create a new trigger in a project.
Permission:
- Users must have the PM_FACTORY permission assigned to their role to perform this action.
Structure:
POST /api/1.0/{workspace}/project/{prj_uid}/trigger
Parameters:
-
Name Type Description workspace String Workspace name prj_uid String Project UID
Required Fields:
-
Name Type Description tri_title String Trigger name
Optional Fields:
-
Name Type Description tri_description String Trigger description tri_webbot String Trigger code. tri_param String Parameters of the trigger in an object in a JSON string. This parameter is only used by the trigger wizard; otherwise set it to ""
(empty string). See the TRIGGERS.TRI_PARAM field in the database for examples.
Result:
-
Type Description object Returns the created trigger object
Example:
Request
{
"tri_title": "Trigger #1",
"tri_description": "Trigger #1 - Desc",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
}
Response
{
"tri_uid": "56812777252a6313aa8cba2043861472",
"tri_title": "Trigger #1",
"tri_description": "Trigger #1 - Desc",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
}
Update Trigger: PUT project/{prj_uid}/trigger/{tri_uid}
Update a trigger in a project.
Permission:
- Users must have the PM_FACTORY permission assigned to their role to perform this action.
Structure:
PUT /api/1.0/{workspace}/project/{prj_uid}/trigger/{tri_uid}
Parameters:
-
Name Type Description workspace String Workspace name prj_uid String Project UID tri_uid String Trigger UID
Optional Fields:
-
Name Type Description tri_title String Trigger title tri_description String Trigger description tri_webbot String Trigger code tri_param String Initial parameters of the trigger
Result:
-
Type Description empty No return
Example:
Request
{
"tri_title": "Trigger #1",
"tri_description": "Trigger #1 - Desc (modified)",
"tri_type": "SCRIPT",
"tri_webbot": "",
"tri_param": "PRIVATE"
}
Response
Delete Trigger: DELETE project/{prj_uid}/trigger/{tri_uid}
Delete a trigger in a project.
Permission:
- Users must have the PM_FACTORY permission assigned to their role to perform this action.
Structure:
DELETE /api/1.0/{workspace}/project/{prj_uid}/trigger/{tri_uid}
Parameters:
-
Name Type Description workspace String Workspace name prj_uid String Project UID tri_uid String Trigger UID
Result:
-
Type Description empty No return
Example:
Response