Event Subscriptions

An EventSubscription selects EventRecords for an EventChannel and sends them to one or more EventTargets.

List Event Subscriptions

SDK Function

EventSubscription.list()

Return Object

ListIterator<EventSubscription>

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

import com.files.ListIterator;
import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.EventSubscription;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  ListIterator<EventSubscription> eventSubscriptions = EventSubscription.list(parameters);
  for (EventSubscription eventSubscription : eventSubscriptions.listAutoPaging()) {
    // Operate on eventSubscription
  }
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Show Event Subscription

SDK Function

EventSubscription.find()

Return Object

EventSubscription

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDescription
id
int64
Required
Event Subscription ID.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.EventSubscription;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  EventSubscription eventSubscription = EventSubscription.find(id, parameters);
  // Operate on eventSubscription
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Create Event Subscription

SDK Function

EventSubscription.create()

Return Object

EventSubscription

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Function Arguments

ArgumentDefaultDescription
event_channel_id
int64
Event Channel ID
workspace_id
int64
0Workspace ID. 0 means the default workspace or site-wide.
apply_to_all_workspaces
boolean
falseIf true, this default-workspace subscription applies to events from all workspaces.
name
string
Required
Event Subscription name.
subject
string
Custom subject line to use for notification emails.
message
string
Custom message to include in notification emails.
message_only
boolean
falseIf true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
enabled
boolean
trueWhether this Event Subscription can dispatch events.
event_types
array(string)
Event type strings matched by this subscription. Blank means all event types.
delivery_policy
object
Event Subscription delivery policy.
event_target_ids
array(int64)
Event Target IDs this subscription sends to.

Additional Arguments

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.EventSubscription;

try {
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("name", "example");
  
  EventSubscription eventSubscription = EventSubscription.create(parameters);
  // Operate on eventSubscription
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Update Event Subscription

SDK Function

eventSubscription.update();

Return Object

EventSubscription

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Attribute Setters

SetterDescription
setEventChannelId
int64
Event Channel ID
setWorkspaceId
int64
Workspace ID. 0 means the default workspace or site-wide.
setApplyToAllWorkspaces
boolean
If true, this default-workspace subscription applies to events from all workspaces.
setName
string
Event Subscription name.
setSubject
string
Custom subject line to use for notification emails.
setMessage
string
Custom message to include in notification emails.
setMessageOnly
boolean
If true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
setEnabled
boolean
Whether this Event Subscription can dispatch events.
setEventTypes
array(string)
Event type strings matched by this subscription. Blank means all event types.
setDeliveryPolicy
object
Event Subscription delivery policy.
setEventTargetIds
array(int64)
Event Target IDs this subscription sends to.

Additional Arguments

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.EventSubscription;

try {
  // Find the eventSubscription object by its id.
  EventSubscription eventSubscription = EventSubscription.find(id, null);
  HashMap<String, Object> parameters = new HashMap<>();
  parameters.put("event_channel_id", 1);
  eventSubscription.update(parameters);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

Delete Event Subscription

SDK Function

eventSubscription.delete();

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Example Request

import com.files.exceptions.*;
import com.files.exceptions.ApiErrorException.*;
import com.files.models.EventSubscription;

try {
  // Find the eventSubscription object by its id.
  EventSubscription eventSubscription = EventSubscription.find(id, null);
  eventSubscription.delete(null);
} catch (NotAuthenticatedException e) {
  System.out.println("Authentication Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
} catch (SdkException e) {
  System.out.println("Unknown Error Occurred (" + e.getClass().getName() + "): " + e.getMessage());
}

The EventSubscription Object

Some of the functions above return a EventSubscription object. The attributes of this object are listed below.

AttributeDescription
id
int64
Event Subscription ID
event_channel_id
int64
Event Channel ID
workspace_id
int64
Workspace ID. 0 means the default workspace or site-wide.
apply_to_all_workspaces
boolean
If true, this default-workspace subscription applies to events from all workspaces.
name
string
Event Subscription name.
subject
string
Custom subject line to use for notification emails.
message
string
Custom message to include in notification emails.
message_only
boolean
If true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
enabled
boolean
Whether this Event Subscription can dispatch events.
event_types
array(string)
Event type strings matched by this subscription. Blank means all event types.
filter
object
Structured event payload filter.
delivery_policy
object
Event Subscription delivery policy.
event_target_ids
array(int64)
Event Target IDs this subscription sends to.
created_at
date-time
Event Subscription create date/time.
updated_at
date-time
Event Subscription update date/time.