Please rate how useful you found this document: 
Average: 2.7 (3 votes)

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_uidTrigger UIDStringString
tri_titleTrigger nameString"Trigger name" (string)
tri_descriptionTrigger descriptionString"Trigger Description" (Alphanumeric String)
tri_webbotTrigger codeString"die('The End.');" (php code)
tri_paramInitial parameters of the triggerString"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:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Result:

TypeDescription
arrayReturns an array of objects with the existent triggers

Example:

Response

 200 (OK)
 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:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
tri_uidStringTrigger UID

Result:

TypeDescription
arrayReturns a trigger object

Example:

Response

 200 (OK)
 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:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID

Required Fields:

NameTypeDescription
tri_titleStringTrigger name

Optional Fields:

NameTypeDescription
tri_descriptionStringTrigger description
tri_webbotStringTrigger code.
tri_paramStringParameters 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:

TypeDescription
objectReturns the created trigger object

Example:

Request

 Content-Type: application/json
 {
    "tri_title": "Trigger #1",
    "tri_description": "Trigger #1 - Desc",
    "tri_type": "SCRIPT",
    "tri_webbot": "",
    "tri_param": "PRIVATE"
 }

Response

 201 (Created)
 {
    "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:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
tri_uidStringTrigger UID

Optional Fields:

NameTypeDescription
tri_titleStringTrigger title
tri_descriptionStringTrigger description
tri_webbotStringTrigger code
tri_paramStringInitial parameters of the trigger

Result:

TypeDescription
emptyNo return

Example:

Request

 Content-Type: application/json
 {
    "tri_title": "Trigger #1",
    "tri_description": "Trigger #1 - Desc (modified)",
    "tri_type": "SCRIPT",
    "tri_webbot": "",
    "tri_param": "PRIVATE"
 }

Response

 200 (OK)


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:

NameTypeDescription
workspaceStringWorkspace name
prj_uidStringProject UID
tri_uidStringTrigger UID

Result:

TypeDescription
emptyNo return

Example:

Response

 200 (OK)