API for Triggers

In this document:

Get Trigger

getTrigger (trigger: GetTriggerInput!): Trigger

Request

Response

Copy
Query​
query {  
getTrigger(trigger: {tenantId: "1", triggerId:"67d6e421-404a-4b43-9aef-2edcd5107c1b"}) {    
    active    
    queueId    
    queueName    
    avoidDuplicateRun    
    creationDate    
    creationUser    
    lastUpdateUser    
    lastUpdateDate    
    lastTriggeredTime    
    credentialId    
    credentialDisplayName    
    id    
    metadata    
    name    
    notifications    
    priority    
    running    
    type    
    useVaultUser    
    variables    
    wizardId    
    wizardName  
  }
}
Copy
Response
{    
    "data": {        
    "getTrigger": {            
        "active": true,            
        "queueId": "28F762C0-72C2-41D1-AFEF-D2893405F1C7",            
        "queueName": "default_queue",            
        "avoidDuplicateRun": false,            
        "creationDate": "2021-11-15T13:32:17.067",            
        "creationUser": "testuser",            
        "lastUpdateUser": "testuser",            
        "lastUpdateDate": "2021-11-15T13:32:17.067",            
        "lastTriggeredTime": null,            
        "credentialId": null,            
        "credentialDisplayName": null,            
        "id": "67d6e421-404a-4b43-9aef-2edcd5107c1b",            
        "metadata": {                
        "rootFolderPath": "C:\\Kryon\\WatchDog\\Logs",                
        "fileSystemFilter": "log*",                
        "userEncryptedCredentials": {                    
        "userCredentials": {                        
        "id": 0                    
       }                
    },                
        "triggerType": "local",                
        "pollingIntervalInSeconds": 300,                
        "monitoringConfig": {                    
        "isIncludeSubFolders": false,                    
        "isCreated": true,                    
        "isModified": false,                    
        "isDeleted": false,                    
        "isExisting": false                
       }            
    },            
        "name": "NewTrigger",            
        "notifications": {},            
        "priority": 0,            
        "running": true,            
        "type": "file",            
        "useVaultUser": false,            
        "variables": [],            
        "wizardId": "2",            
        "wizardName": "Create Trigger's & Task's"        
       }    
    }
}

Get All Triggers With Filter Option

Request

Response

Copy

Query

query {
  triggers(queryInput:{
  sort: [
    {
      field: "name",
      dir: ASC
    }
  ],
  filter: {
    filters: [
        {
            filters: [
                {
                    field: "name",
                    operator: CONTAINS,
                    value: "testtrigger"
                }
            ],
            logic: OR
        }
    ],
    logic: AND
    },
  take: 25,
  skip: 0
  }) {
    items {
        id
        name
        type
        creationUser
        tenantId
        active
        priority
        running
        queueId
        queueName
        scriptId
        scriptName
        metadata
    }
    totalRecords
  }
}
Copy

Response

{
    "data": {
        "triggers": {
            "items": [
                {
                    "id": "4dc89996-8605-485c-ba1e-3de161d46629",
                    "name": "testtrigger",
                    "type": "kryon-scheduled",
                    "creationUser": "kryonadmin",
                    "tenantId": "1",
                    "active": false,
                    "priority": 0,
                    "running": false,
                    "queueId": "9cce3b11-5b67-47c5-8dbc-dadfe214cde7",
                    "queueName": "Q1",
                    "scriptId": "1",
                    "scriptName": "wizard",
                    "metadata": "{\"cronExpression\":\"0 0/1 * ? * * *\",\"timeZoneId\":\"Asia/Jerusalem\"}"
                }
            ],
            "totalRecords": 1
        }
    }
}

Get Trigger By ID

Request

Response

Copy

Query

query {
  getTrigger(trigger: {
      tenantId: "1",
      triggerId: "ecd630a9-4fc1-44db-9790-2178c015f879"
  }) {
        id
        name
        type
        creationUser
        creationDate
        lastUpdateUser
        lastUpdateDate
        lastTriggeredTime
        active
        queueId
        queueName
        priority
        running
        workflowId
        workflowName
        metadata
        credentialId
        credentialDisplayName
        useVaultUser
        avoidDuplicateRun
        notifications
        variables
  }
}
Copy

Response

{
    "data": {
        "getTrigger": {
            "id": "ecd630a9-4fc1-44db-9790-2178c015f879",
            "name": "filetrigger1",
            "type": "kryon-file",
            "creationUser": "kryonadmin",
            "creationDate": "2022-04-27T13:59:41.17",
            "lastUpdateUser": "public-api",
            "lastUpdateDate": "2022-04-27T14:34:33.117",
            "lastTriggeredTime": null,
            "active": false,
            "queueId": "9cce3b11-5b67-47c5-8dbc-dadfe214cde7",
            "queueName": "Q1",
            "priority": 9,
            "running": false,
            "workflowId": "1",
            "workflowName": "wizard",
            "metadata": {
                "rootFolderPath": "c:\\\\tpp",
                "fileSystemFilter": "*.*",
                "userEncryptedCredentials": {
                    "userCredentials": {
                        "id": 0
                    },
                    "oAuthClientId": ""
                },
                "triggerType": "local",
                "pollingIntervalInSeconds": 20,
                "monitoringConfig": {
                    "isIncludeSubFolders": true,
                    "isCreated": true,
                    "isModified": true,
                    "isDeleted": true,
                    "isExisting": true
                }
            },
            "credentialId": null,
            "credentialDisplayName": null,
            "useVaultUser": false,
            "avoidDuplicateRun": false,
            "notifications": {},
            "variables": []
        }
    }
}

Get Trigger Status

Request

Response

Copy
Query
query {
  getTriggerStatus(trigger: {
      tenantId: "1",
      triggerId: "ecd630a9-4fc1-44db-9790-2178c015f879"
  }) {
        status
  }
}
Copy
Response
{
    "data": {
        "getTriggerStatus": {
            "status": "INACTIVE"
        }
    }
}

Create a Trigger

Request

Response

Copy
Mutation
mutation {
  addTrigger(
    trigger: {
        active: false,
        assignmentId: "9cce3b11-5b67-47c5-8dbc-dadfe214cde7",
        assignmentType: QUEUE,
        avoidDuplicateRun: true,
        id: "8C98516c-4124-657e-bbcb-2bff8a756b9c",
        metadata: "{\"cronExpression\":\"0 0 0 1/30 * ? *\",\"timeZoneId\":\"Europe/Sofia\"}",
        name: "TestAPI_AddedTrigger21",
        notifications: "{}",
        priority: 10,
        schemaVersion: "1.0",
        tenantId: "1",
        type: "kryon-scheduled",
        username: "kryonadmin",
        variables: "[{\"name\":\"apivar1\",\"value\":\"todor1\"}]",
        wizardId: "2"
    })
}
Copy
Response
{
    "data": {
        "addTrigger": true
    }
}

Reassign Trigger to Another Queue

Request

Response

Copy
Mutation
mutation {
  reassignTriggersToQueue(
    triggersIds: ["8c98516c-4124-657e-bbcb-2bff8a756b9c"],
    queueId: "d0224995-83c6-4df1-bc53-088f81c5dd2f"
  ) {
    idsWithVersion {
        id
        updateVersion
    }
  }
}
Copy

Response

{
    "data": {
        "reassignTriggersToQueue": {
            "idsWithVersion": [
                {
                    "id": "8c98516c-4124-657e-bbcb-2bff8a756b9c",
                    "updateVersion": 1
                }
            ]
        }
    }
}

Update Trigger to Priority

Request

Response

Copy

Mutation

mutation {
  setTriggersPriority(
    triggersIds: ["ecd630a9-4fc1-44db-9790-2178c015f879"],
    priority: 7
  ) {
    idsWithVersion {
        id
        updateVersion
    }
  }
}
Copy

Response

{
    "data": {
        "setTriggersPriority": {
            "idsWithVersion": [
                {
                    "id": "ecd630a9-4fc1-44db-9790-2178c015f879",
                    "updateVersion": 10
                }
            ]
        }
    }
}

Activate/Deactivate Trigger

Request

Response

Copy

Mutation

mutation {
  toggleActiveTriggers(
    triggersIds: ["3c96517c-4024-658e-bbcb-2bff8a756b7c"],
    active: true
  ) {
    idsWithVersion {
        id
        updateVersion
    }
  }
}
Copy

Response

{
    "data": {
        "toggleActiveTriggers": {
            "idsWithVersion": [
                {
                    "id": "3c96517c-4024-658e-bbcb-2bff8a756b7c",
                    "updateVersion": 4
                }
            ]
        }
    }
}