Sitevision Developer
Log in

Log in

System Event Options

System events is a special kind of server-side events. A system event always starts with the sv namespace and they can only be emitted by Sitevision, not by RESTApps. System events has a category that groups related operations. RESTApps can act on the operation as well as the category (but never on the namespace).

sv:category:operation

The documentation of the specific system event must be consulted to properly handle the event options fully. Though, all system events always contain some properties that are added automatically when they are emitted:

// Event options present in all system events
{
   event: 'sv:publishing:publish', // The full name of the event
   emitter: '247.12121212',        // The JCR identifier of the emitting user [@since 4.5.5]   
   timestamp: 12345678890123456,   // The timestamp when the event was emitted
   ...
}

Note that the timestamp might differ from model time data!

For example: the timestamp of a sv:publishing:publish event is not guaranteed to be the exact same reference in time as the lastPublishDate property of the sv:page that was published!

sv:publishing

Sitevision emits system events in the publishing category whenever a publishing-related operation is performed (e.g. page is published or unpublished).

sv:publishing:publish

 Emitted when something (typically a page) is published.

// sv:publishing:publish options example
{
   event: 'sv:publishing:publish', // The full name of the event
   emitter: '247.12121212',        // The JCR identifier of the emitting user [@since 4.5.5]   
   timestamp: 12345678890123456,   // The timestamp when the event was emitted
   node: '4.121212121212'          // The JCR identifier of the Node that was published
}

sv:publishing:unpublish

 Emitted when something (typically a page) is unpublished.

// sv:publishing:unpublish options example
{
   event: 'sv:publishing:unpublish', // The full name of the event
   emitter: '247.12121212',          // The JCR identifier of the emitting user [@since 4.5.5]   
   timestamp: 12345678890123456,     // The timestamp when the event was emitted
   node: '4.121212121212'            // The JCR identifier of the Node that was unpublished
}

sv:simpleuser

Sitevision emits system events in the simpleuser category whenever a operation related to a simple user is performed.

sv:simpleuser:create

 Emitted when a simple user is created.

// sv:simpleuser:create options example
{
   event: 'sv:simpleuser:create', // The full name of the event
   emitter: '247.12121212',       // The JCR identifier of the emitting user [@since 4.5.5]   
   timestamp: 12345678890123456,  // The timestamp when the event was emitted
   user: '255.121212121212'       // The JCR identifier of the simple user that was created
}

sv:simpleuser:update

 Emitted when a simple user is updated.

// sv:simpleuser:update options example
{
   event: 'sv:simpleuser:update', // The full name of the event
   emitter: '247.12121212',       // The JCR identifier of the emitting user [@since 4.5.5]   
   timestamp: 12345678890123456,  // The timestamp when the event was emitted
   user: '255.121212121212'       // The JCR identifier of the simple user that was updated
}

sv:simpleuser:session:destroy [@since 2024.04.1]

Emitted when the http session for a simple user is destroyed (e.g. session timed out).

// sv:simpleuser:session:destroy options example
{
   event: 'sv:simpleuser:session:destroy', // The full name of the event
   emitter: 'anonymous',                   // No user is emitting the event
   timestamp: 12345678890123456,           // The timestamp when the event was emitted
   user: '255.121212121212'                // The JCR identifier of the simple user whose session was destroyed
}

The destroy event is not emitted by a specific user. This means that anything performed inside the event is done as Anonymous which in turn means there are no rights and permissions. Acting on the destroy event would therefore typically imply usage of the privileged functionality.

sv:structure [@since 6.1]

Sitevision emits system events in the structure category whenever a structure-related operation is performed (e.g. page is moved).

sv:structure:move

 Emitted when something (typically a page) is moved.

// sv:structure:move options example
{
   event: 'sv:structure:move',   // The full name of the event
   emitter: '247.12121212',      // The JCR identifier of the emitting user
   timestamp: 12345678890123456, // The timestamp when the event was emitted
   node: '4.121212121212',       // The JCR identifier of the Node that was moved
   from: '19.32323232323',       // The JCR identifier of the old parent Node
   to: '19.45454545454'          // The JCR identifier of the new parent Node
}

sv:trashcan [@since 5.1]

Sitevision emits system events in the trashcan category whenever an item is added to the trashcan or restored from the trashcan.

sv:trashcan:add

 Emitted when something (typically a page/article/file/image) is added to the trashcan.

// sv:trashcan:add options example
{
   event: 'sv:trashcan:add',     // The full name of the event
   emitter: '247.12121212',      // The JCR identifier of the emitting user
   timestamp: 12345678890123456, // The timestamp when the event was emitted
   node: '4.121212121212'        // The JCR identifier of the Node that was trashed
}

sv:trashcan:restore

Emitted when something (typically a page/article/file/image) is restored from the trashcan.

// sv:trashcan:restore options example
{
   event: 'sv:trashcan:restore', // The full name of the event
   emitter: '247.12121212',      // The JCR identifier of the emitting user
   timestamp: 12345678890123456, // The timestamp when the event was emitted
   node: '4.121212121212'        // The JCR identifier of the Node that was restored
}

sv:binary [@since 7.2]

Sitevision emits system events in the binary category whenever a file or an image is added or modified.

sv:binary:create

Emitted when a file or an image is added to a repository or folder.

// sv:binary:create options example
{
   event: 'sv:binary:create',    // The full name of the event
   emitter: '247.12121212',      // The JCR identifier of the emitting user
   timestamp: 12345678890123456, // The timestamp when the event was emitted
   node: '18.121212121212'       // The JCR identifier of the file that has been created
}

sv:binary:update:content

Emitted when the content for a file or an image has been updated.

// sv:binary:update:content options example
{
   event: 'sv:binary:update:content', 	// The full name of the event
   emitter: '247.12121212',      		// The JCR identifier of the emitting user
   timestamp: 12345678890123456, 		// The timestamp when the event was emitted
   node: '18.121212121212'        		// The JCR identifier of the file that was updated
}

sv:binary:update:metadata

Emitted when metadata for a file or an image has been updated.

// sv:binary:update:metadata options example
{
   event: 'sv:binary:update:metadata', 	// The full name of the event
   emitter: '247.12121212',      		// The JCR identifier of the emitting user
   timestamp: 12345678890123456, 		// The timestamp when the event was emitted
   node: '18.121212121212'        		// The JCR identifier of the file that has updated metadata 
}

sv:binary:update:name

Emitted when the name of a file or an image has been changed.

// sv:binary:update:name options example
{
   event: 'sv:binary:update:name', 	// The full name of the event
   emitter: '247.12121212',      	// The JCR identifier of the emitting user
   timestamp: 12345678890123456, 	// The timestamp when the event was emitted
   node: '18.121212121212'        	// The JCR identifier of the file that has been renamed 
}

sv:binary:update:tags

Emitted when tags for a file or an image has been changed.

// sv:binary:update:tags options example
{
   event: 'sv:binary:update:tags', 	// The full name of the event
   emitter: '247.12121212',      	// The JCR identifier of the emitting user
   timestamp: 12345678890123456, 	// The timestamp when the event was emitted
   node: '18.121212121212'        	// The JCR identifier of the file that was changed 
}

sv:binary:update:version:create

Emitted when a new version of a file has been created.

// sv:binary:update:version:create options example
{
   event: 'sv:binary:update:version:create', // The full name of the event
   emitter: '247.12121212',                  // The JCR identifier of the emitting user
   timestamp: 12345678890123456,             // The timestamp when the event was emitted
   node: '18.121212121212'                   // The JCR identifier of the file that has av new version
}

sv:binary:update:version:delete

Emitted when a version of a file has been deleted.

// sv:binary:update:version:delete options example
{
   event: 'sv:binary:update:version:delete', // The full name of the event
   emitter: '247.12121212',                  // The JCR identifier of the emitting user
   timestamp: 12345678890123456,             // The timestamp when the event was emitted
   node: '18.121212121212'                   // The JCR identifier of the file that has a deleted version
}

sv:binary:update:version:select

Emitted when a version of a file has been selected.

// sv:binary:update:version:select options example
{
   event: 'sv:binary:update:version:select', // The full name of the event
   emitter: '247.12121212',                  // The JCR identifier of the emitting user
   timestamp: 12345678890123456,             // The timestamp when the event was emitted
   node: '18.121212121212'                   // The JCR identifier of the file that has a new version selected 
}

Timer events [@since 5.2]

Sitevision periodically emits timer events in five intervals:

  • sv:every-5-minutes
  • sv:every-15-minutes
  • sv:every-30-minutes
  • sv:every-hour
  • sv:every-day

Timer events are system global, hence triggered on all websites and not emitted by a specific user. This means that anything done inside the event is done as Anonymous which in turn means there are no rights and permissions. A RESTApp that acts on a timer event must finish its execution before next event interval occurs.

Executing code as a specified user is available as of Sitevision 7 via the privileged functionality.

// sv:every-hour options example
{
   event: 'sv:every-hour',      // The full name of the event
   emitter: 'anonymous',        // No user is emitting the event
   timestamp: 12345678890123456 // The timestamp when the event was emitted
}

Execution of a timer event must be completed within the specific event interval!

A RESTApp that acts on a timer event and executes longer than the interval for that event, will cause all RESTApps on that site to not receive any further timer events of that specific type, until its execution is completed. E.g. if execution of a 5-minutes event takes 12 minutes, all RESTApps on that site will miss two 5-minutes events.

Beware of overlap when acting on more than one timer event!

Timer events are executed periodically and intervals will overlap each other every now and then (e.g. for every third 5-minutes event, there will also be a 15-minutes event).

Timer events has no category since it has no semantic meaning!

RESTApps that are interested in "all timer events" can act on the most frequently emitted sv:every-5-minutes event and do its custom time-related logic.

Did you find the content on this page useful?