Endpoint: /sites/{siteid}/event-rules/{ruleid}

Get, modify, or delete a specific site event rule

  • GET

  • PATCH

  • DELETE

Method & URL

GET https://[server URL]:[port]/admin/v2/sites/{siteId}/event-rules/{ruleid}

GET Body Sample

Copy
### GET SPECIFIC EVENT RULE ###
@eventRuleID = {{eventRuleList.response.body.$.data[0].id}}
GET https://{{host}}/admin/v2/sites/{{Siteid}}/event-rules/{{eventRuleID}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
###

GET Response Body Sample

Copy
{"data":{"type":"eventRule","id":"8d11ec4f-3c6c-4ab9-8045-fb5c94b38ca0","attributes":{"info":
{"Description":"Backup and Cleanup","Enabled":true,"Folder":"00000000-0000-0000-0000-000000000000",
"Name":"Backup and Cleanup","Next":"c2320fbb-e7cc-4fde-8b41-ffa655e71e50","Remote":false,
"Type":"Timer","apiVersion":"v2","eventRuleVersion":"416"},"statements":{
"StatementsList":[{"ActionStatement":{"Action":{"CleanupAction":{"DaysToKeepFiles":30,
"FileMask":"*.bak","Folder":"C:\\ProgramData\\Globalscape\\EFT Server\\Backup",
"Include":true,"Recursive":false,"TimestampType":"Both"}},"IfFailedActions":[]},
"ConditionStatement":{"Conditions":[],"ElseAttachedStatements":[],"IfAttachedStatements":[],
"Operator":"Or"},"LoopDatasetStatement":{"Params":{"DatasetName":"","EndLoopRow":0,
"OrderingColumn":"","SortOrder":"Original","StartLoopRow":0,"UseEndLoopRow":false,
"UseStartLoopRow":false},"Statements":[]},"Type":"Action"},{"ActionStatement":{
"Action":{"CleanupAction":{"DaysToKeepFiles":30,"FileMask":"*.*",
"Folder":"C:\\ProgramData\\Globalscape\\EFT Server\\Logs",
"Include":true,"Recursive":false,"TimestampType":"Both"}},"IfFailedActions":[]},
"ConditionStatement":{"Conditions":[],"ElseAttachedStatements":[],"IfAttachedStatements":[],
"Operator":"Or"},"LoopDatasetStatement":{"Params":{"DatasetName":"",
"EndLoopRow":0,"OrderingColumn":"","SortOrder":"Original","StartLoopRow":0,"UseEndLoopRow":false,
"UseStartLoopRow":false},"Statements":[]},"Type":"Action"},{"ActionStatement":
{"Action":{"BackupServerAction":{"Path":"C:\\ProgramData\\Globalscape\\EFT Server\\Backup"}},
"IfFailedActions":[{"StopAction":{"Enabled":false,"Result":"StopThisRule"}}]},
"ConditionStatement":{"Conditions":[],"ElseAttachedStatements":[],"IfAttachedStatements":[],
"Operator":"Or"},"LoopDatasetStatement":{"Params":{"DatasetName":"","EndLoopRow":0,
"OrderingColumn":"","SortOrder":"Original","StartLoopRow":0,"UseEndLoopRow":false,
"UseStartLoopRow":false},"Statements":[]},"Type":"Action"}]},"trigger":{"TimerParams":{
"DailyInfo":{"DayPeriod":1,"EveryWeekDay":true},"EndDateEnabled":false,"EndDateTime":1659675600,
"EndTimeEnabled":false,"HolidayCalendarID":"00000000-0000-0000-0000-000000000000",
"MonthlyInfo":{"DayPeriod":1,"MonthPeriod":1,"RelativeDay":"First","UseFixedDayIndexInMonth":true,
"Weekday":"Sunday"},"Recurrence":"Daily","RepeatEnabled":false,"RepeatPattern":"Hours",
"RepeatRate":1,"RundayCalendarID":"00000000-0000-0000-0000-000000000000",
"StartDateTime":1659675600,"WeeklyInfo":{"WeekDayFlags":1,"WeekPeriod":1},
"YearlyInfo":{"DayPeriod":1,"Month":"January","RelativeDay":"First",
"UseFixedDayIndexInFixedMonth":true,"Weekday":"Sunday"}}}},"link":{"self":
"/admin/v2/sites/6203305a-d7c6-499e-a59b-81500765f8f2/event-rules/8d11ec4f-3c6c-4ab9-8045-fb5c94b38ca0"}}}

GET PowerShell Sample

Copy
### Returns event rule settings ###
### User must obtain the SiteID from Get Sites
Write-Output "ER"
Write-Output "----"
#$siteID = Enter SiteID here
$ERList = Invoke-RestMethod -Uri 
"$baseURL/v2/sites/$siteID/event-rules" -Method 'GET' -Headers $authHeader
Write-Output $ERList | ConvertTo-Json 

$ERID = $ERList.data[0].id

$ERsList = Invoke-RestMethod -Uri 
"$baseURL/v2/sites/$siteID/event-rules/$ERID" -Method 'GET' -Headers $authHeader
Write-Output $ERsList | ConvertTo-Json 

Method & URL

PATCH https://[server URL]:[port]/admin/v2/sites/{siteId}/event-rules/{ruleid}

PATCH Body Sample

Copy
###

PATCH https://{{host}}/admin/v2/sites/{{Siteid}}/event-rules/{{eventRuleID}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

{
  "data": {
      "type": "eventRule",
      "attributes": {
        "info": {
          "Description": "Execute a specified action one time or repeat at a specified interval.",
          "Name": "Backups Revisited"
        }
    }
  }
}
###

PATCH Response Body Sample

Copy
{"data":{"type":"eventRule","id":"8d11ec4f-3c6c-4ab9-8045-fb5c94b38ca0","attributes":{"info":
{"Description":"Execute a specified action one time or repeat at a specified interval.",
"Enabled":true,"Folder":"00000000-0000-0000-0000-000000000000","Name":"Backups Revisited",
"Next":"c2320fbb-e7cc-4fde-8b41-ffa655e71e50","Remote":false,"Type":"Timer","apiVersion":"v2",
"eventRuleVersion":"416"},"statements":{"StatementsList":[{"ActionStatement":{"Action":
{"CleanupAction":{"DaysToKeepFiles":30,"FileMask":"*.bak","Folder":
"C:\\ProgramData\\Globalscape\\EFT Server\\Backup","Include":true,"Recursive":false,
"TimestampType":"Both"}},"IfFailedActions":[]},"ConditionStatement":{"Conditions":[],
"ElseAttachedStatements":[],"IfAttachedStatements":[],"Operator":"Or"},"LoopDatasetStatement":{
"Params":{"DatasetName":"","EndLoopRow":0,"OrderingColumn":"","SortOrder":"Original",
"StartLoopRow":0,"UseEndLoopRow":false,"UseStartLoopRow":false},"Statements":[]},"Type":"Action"},
{"ActionStatement":{"Action":{"CleanupAction":{"DaysToKeepFiles":30,"FileMask":"*.*",
"Folder":"C:\\ProgramData\\Globalscape\\EFT Server\\Logs","Include":true,"Recursive":false,
"TimestampType":"Both"}},"IfFailedActions":[]},"ConditionStatement":{"Conditions":[],
"ElseAttachedStatements":[],"IfAttachedStatements":[],"Operator":"Or"},"LoopDatasetStatement":
{"Params":{"DatasetName":"","EndLoopRow":0,"OrderingColumn":"","SortOrder":"Original",
"StartLoopRow":0,"UseEndLoopRow":false,"UseStartLoopRow":false},"Statements":[]},
"Type":"Action"},{"ActionStatement":{"Action":{"BackupServerAction":{"Path":
"C:\\ProgramData\\Globalscape\\EFT Server\\Backup"}},"IfFailedActions":[{"StopAction":
{"Enabled":false,"Result":"StopThisRule"}}]},"ConditionStatement":{"Conditions":[],
"ElseAttachedStatements":[],"IfAttachedStatements":[],"Operator":"Or"},"LoopDatasetStatement":
{"Params":{"DatasetName":"","EndLoopRow":0,"OrderingColumn":"","SortOrder":"Original",
"StartLoopRow":0,"UseEndLoopRow":false,"UseStartLoopRow":false},"Statements":[]},
"Type":"Action"}]},"trigger":{"TimerParams":{"DailyInfo":{"DayPeriod":1,"EveryWeekDay":true},
"EndDateEnabled":false,"EndDateTime":1659675600,"EndTimeEnabled":false,
"HolidayCalendarID":"00000000-0000-0000-0000-000000000000","MonthlyInfo":{"DayPeriod":1,
"MonthPeriod":1,"RelativeDay":"First","UseFixedDayIndexInMonth":true,"Weekday":"Sunday"},
"Recurrence":"Daily","RepeatEnabled":false,"RepeatPattern":"Hours","RepeatRate":1,
"RundayCalendarID":"00000000-0000-0000-0000-000000000000","StartDateTime":1659675600,
"WeeklyInfo":{"WeekDayFlags":1,"WeekPeriod":1},"YearlyInfo":{"DayPeriod":1,"Month":"January",
"RelativeDay":"First","UseFixedDayIndexInFixedMonth":true,"Weekday":"Sunday"}}}},"link":
{"self":"/admin/v2/sites/6203305a-d7c6-499e-a59b-81500765f8f2/event-rules/
8d11ec4f-3c6c-4ab9-8045-fb5c94b38ca0"}}}

PATCH PowerShell Sample

Copy
##Patch SITE EVENT RULE settings
Write-Output "Site Event Rule PATCH"
Write-Output "-----"
$update = 
'{
  "data": {
      "type": "eventRule",
      "attributes": {
        "info": {
          "Description": "Execute a specified action one time or 
          repeat at a specified interval.",
          "Name": "Backups Revisited"
        }
    }
  }
}'
$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 10
$patchReturn = Invoke-RestMethod -Uri 
"$baseURL/v2/sites/$siteID/event-rules/$ERID" -Method 'PATCH' 
-Headers $authHeader -Body $update
Write-Output $patchReturn | ConvertTo-Json 

Method & URL

DELETE https://[server URL]:[port]/admin/v2/sites/{siteId}/event-rules/{ruleid}

DELETE Body Sample

Copy
### GET SPECIFIC EVENT RULE ###
@eventRuleID = {{eventRuleList.response.body.$.data[0].id}}
DELETE https://{{host}}/admin/v2/sites/{{Siteid}}/event-rules/{{eventRuleID}} HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}
###

DELETE Response Body Sample

Copy
HTTP/1.1 204 No Content
Date: Tue, 09 Aug 2022 12:24:53 GMT
Content-Length: 0
Cache-Control: no-cache, no-store, must-revalidate
Expires: -1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' data:;
Referrer-Policy: no-referrer

DELETE PowerShell Sample

Copy
$ERID = $ERList.data[1].id

$ERsList = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/event-rules/$ERID" 
-Method 'DELETE' -Headers $authHeader
Write-Output $ERsList | ConvertTo-Json