API event - RapturePlatform/Rapture GitHub Wiki

Event API

Events are used to coordinate large scale activity in Rapture. The process is relatively simple: a caller assigns any number of scripts to a named event (simply a unique path), and then when the event is fired all attached scripts are scheduled for execution. Some events are internally managed (system events) and other events can be user created and managed.

getEvent

HttpEventApi eventApi = new HttpEventApi(loginApi);
RaptureEvent retVal = eventApi.getEvent(eventUri);
retVal = baseAPI.doEvent_GetEvent(eventUri);

Entitlement: /event/admin

This method is used to retrieve information about an event (primarily the scripts attached to it).

Function Parameters

Parameter Type Description
eventUri String

Return value

Type Description
RaptureEvent
Types used in this function

RaptureEvent

Describes the main object used by the Event API.

Field Type
uriFullPath String
scripts Set(RaptureEventScript)
messages Set(RaptureEventMessage)
notifications Set(RaptureEventNotification)
workflows Set(RaptureEventWorkflow)

putEvent

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.putEvent(event);
retVal = baseAPI.doEvent_PutEvent(event);

Entitlement: /event/admin

This method puts an event in the system.

Function Parameters

Parameter Type Description
event RaptureEvent

Return value

Type Description
void
Types used in this function

RaptureEvent

Describes the main object used by the Event API.

Field Type
uriFullPath String
scripts Set(RaptureEventScript)
messages Set(RaptureEventMessage)
notifications Set(RaptureEventNotification)
workflows Set(RaptureEventWorkflow)

deleteEvent

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.deleteEvent(eventUri);
retVal = baseAPI.doEvent_DeleteEvent(eventUri);

Entitlement: /event/admin

This method removes an event (and any attached scripts) from the system. If the event is fired at a later point nothing will happen as there would be no scripts attached.

Function Parameters

Parameter Type Description
eventUri String

Return value

Type Description
void

listEventsByUriPrefix

HttpEventApi eventApi = new HttpEventApi(loginApi);
List<RaptureFolderInfo> retVal = eventApi.listEventsByUriPrefix(eventUriPrefix);
retVal = baseAPI.doEvent_ListEventsByUriPrefix(eventUriPrefix);

Entitlement: /user/get

Return a list of full display names of the paths below this one. Ideally optimized depending on the repo.

Function Parameters

Parameter Type Description
eventUriPrefix String

Return value

Type Description
List

addEventScript

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.addEventScript(eventUri, scriptUri, performOnce);
retVal = baseAPI.doEvent_AddEventScript(eventUri, scriptUri, performOnce);

Entitlement: /event/admin

This method is used to attach a script to an event. A final parameter signals whether this script should be detached from the event when it is fired.

Function Parameters

Parameter Type Description
eventUri String
scriptUri String
performOnce boolean

Return value

Type Description
void

deleteEventScript

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.deleteEventScript(eventUri, scriptUri);
retVal = baseAPI.doEvent_DeleteEventScript(eventUri, scriptUri);

Entitlement: /event/admin

This method detaches a script from the event.

Function Parameters

Parameter Type Description
eventUri String
scriptUri String

Return value

Type Description
void

addEventMessage

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.addEventMessage(eventUri, name, pipeline, params);
retVal = baseAPI.doEvent_AddEventMessage(eventUri, name, pipeline, params);

Entitlement: /event/admin

This method is used to attach a message to an event. When the event is fired a message is sent to the pipeline with content based on the context of the event and parameters passed to this call.

Function Parameters

Parameter Type Description
eventUri String
name String
pipeline String
params Map<String,String>

Return value

Type Description
void

deleteEventMessage

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.deleteEventMessage(eventUri, name);
retVal = baseAPI.doEvent_DeleteEventMessage(eventUri, name);

Entitlement: /event/admin

This method reverses the message attachment, using the same name as passed in the original attachMessage call

Function Parameters

Parameter Type Description
eventUri String
name String

Return value

Type Description
void

addEventNotification

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.addEventNotification(eventUri, name, notification, params);
retVal = baseAPI.doEvent_AddEventNotification(eventUri, name, notification, params);

Entitlement: /event/admin

This method is used to attach a notification to an event. When the event is fired a message is sent to the notification with content based on the context of the event and parameters passed to this call.

Function Parameters

Parameter Type Description
eventUri String
name String
notification String
params Map<String,String>

Return value

Type Description
void

deleteEventNotification

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.deleteEventNotification(eventUri, name);
retVal = baseAPI.doEvent_DeleteEventNotification(eventUri, name);

Entitlement: /event/admin

This method reverses the notification attachment, using the same name as passed in the original attachNotification call

Function Parameters

Parameter Type Description
eventUri String
name String

Return value

Type Description
void

addEventWorkflow

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.addEventWorkflow(eventUri, name, workflowUri, params);
retVal = baseAPI.doEvent_AddEventWorkflow(eventUri, name, workflowUri, params);

Entitlement: /event/admin

This method is used to attach a workflow (dp) to an event. When the event is fired an instance of the workflow is started.

Function Parameters

Parameter Type Description
eventUri String
name String
workflowUri String
params Map<String,String>

Return value

Type Description
void

deleteEventWorkflow

HttpEventApi eventApi = new HttpEventApi(loginApi);
void retVal = eventApi.deleteEventWorkflow(eventUri, name);
retVal = baseAPI.doEvent_DeleteEventWorkflow(eventUri, name);

Entitlement: /event/admin

This method reverses the notification attachment, using the same name as passed in the original attachWorflowToEvent call.

Function Parameters

Parameter Type Description
eventUri String
name String

Return value

Type Description
void

runEvent

HttpEventApi eventApi = new HttpEventApi(loginApi);
boolean retVal = eventApi.runEvent(eventUri, associatedUri, eventContext);
retVal = baseAPI.doEvent_RunEvent(eventUri, associatedUri, eventContext);

Entitlement: /event/admin

This method fires an event, scheduling any attached scripts to run. The optional displayName and contextparameters are passed to the script when fired.

Function Parameters

Parameter Type Description
eventUri String
associatedUri String
eventContext String

Return value

Type Description
boolean

runEventWithContext

HttpEventApi eventApi = new HttpEventApi(loginApi);
RunEventHandle retVal = eventApi.runEventWithContext(eventUri, associatedUri, eventContextMap);
retVal = baseAPI.doEvent_RunEventWithContext(eventUri, associatedUri, eventContextMap);

Entitlement: /event/admin

This method fires an event, scheduling any attached workflows or scripts to run. The optional associatedURI and contextmap are passed to the event workflow when fired. The event's unique id is returned. This id is passed to any scripts, workflows, etcinvoked by the event

Function Parameters

Parameter Type Description
eventUri String
associatedUri String
eventContextMap Map<String,String>

Return value

Type Description
RunEventHandle
Types used in this function

RunEventHandle

This is a write handle returned after an event is executed.

Field Type
eventUri RaptureURI
eventId String
didRun Boolean

eventExists

HttpEventApi eventApi = new HttpEventApi(loginApi);
boolean retVal = eventApi.eventExists(eventUri);
retVal = baseAPI.doEvent_EventExists(eventUri);

Entitlement: /event/admin

Determines whether an event has been defined.

Function Parameters

Parameter Type Description
eventUri String

Return value

Type Description
boolean

deleteEventsByUriPrefix

HttpEventApi eventApi = new HttpEventApi(loginApi);
List<String> retVal = eventApi.deleteEventsByUriPrefix(uriPrefix);
retVal = baseAPI.doEvent_DeleteEventsByUriPrefix(uriPrefix);

Entitlement: /data/write/$f(uriPrefix)

Removes a folder and its contents recursively, including empty subfolders. Validates entitlement on individual events and folders. Returns a list of the events and folders removed.

Function Parameters

Parameter Type Description
uriPrefix String

Return value

Type Description
List
⚠️ **GitHub.com Fallback** ⚠️