Class: Events

Events(client)

Simple manager for interacting with all 'Events' endpoints and actions.

Constructor

new Events(client)

Parameters:
Name Type Description
client BoxClient The Box API Client that is responsible for making calls to the API
Source:

Methods

get(optionsopt, callbackopt) → {Promise.<Object>}

Get a chunk of events API Endpoint: '/events' Method: GET To get events from admin events stream you have to pick stream_type from `admin_logs` or `admin_logs_streaming`. The `admin_logs` stream emphasis is on completeness over latency, which means that Box will deliver admin events in chronological order and without duplicates, but with higher latency. You can specify start and end time/dates. To monitor recent events that have been generated within Box across the enterprise use `admin_logs_streaming` as stream type. The emphasis for this feed is on low latency rather than chronological accuracy, which means that Box may return events more than once and out of chronological order. Events are returned via the API around 12 seconds after they are processed by Box (the 12 seconds buffer ensures that new events are not written after your cursor position). Only two weeks of events are available via this feed, and you cannot set start and end time/dates.
Parameters:
Name Type Attributes Description
options Object <optional>
Additional options for the request. Can be left null in most cases.
Properties
Name Type Attributes Description
stream_type string <optional>
From which stream events should be selected. Possible values are `admin_logs` and `admin_logs_streaming`
created_after string <optional>
The date to start from in ISO-8601 timestamp format: '2001-01-01T00:00:00-08:00'
created_before string <optional>
The date to end at in ISO-8601 timestamp format: '2001-01-01T00:00:00-08:00'
event_type string <optional>
String of event types to return coma separated: for example 'DOWNLOAD,UPLOAD'
limit number <optional>
Number of events to fetch per call
stream_position string <optional>
The stream position to start from (pass '0' for all past events)
callback function <optional>
Passed the current stream position if successful
Source:
Returns:
A promise resolving to the collection of events
Type
Promise.<Object>

get(optionsopt, callbackopt) → {Promise.<Object>}

Get a chunk of events API Endpoint: '/events' Method: GET To get events from admin events stream you have to pick stream_type from `admin_logs` or `admin_logs_streaming`. The `admin_logs` stream emphasis is on completeness over latency, which means that Box will deliver admin events in chronological order and without duplicates, but with higher latency. You can specify start and end time/dates. To monitor recent events that have been generated within Box across the enterprise use `admin_logs_streaming` as stream type. The emphasis for this feed is on low latency rather than chronological accuracy, which means that Box may return events more than once and out of chronological order. Events are returned via the API around 12 seconds after they are processed by Box (the 12 seconds buffer ensures that new events are not written after your cursor position). Only two weeks of events are available via this feed, and you cannot set start and end time/dates.
Parameters:
Name Type Attributes Description
options Object <optional>
Additional options for the request. Can be left null in most cases.
Properties
Name Type Attributes Description
stream_type string <optional>
From which stream events should be selected. Possible values are `admin_logs` and `admin_logs_streaming`
created_after string <optional>
The date to start from in ISO-8601 timestamp format: '2001-01-01T00:00:00-08:00'
created_before string <optional>
The date to end at in ISO-8601 timestamp format: '2001-01-01T00:00:00-08:00'
event_type string <optional>
String of event types to return coma separated: for example 'DOWNLOAD,UPLOAD'
limit number <optional>
Number of events to fetch per call
stream_position string <optional>
The stream position to start from (pass '0' for all past events)
callback function <optional>
Passed the current stream position if successful
Source:
Returns:
A promise resolving to the collection of events
Type
Promise.<Object>

getCurrentStreamPosition(callbackopt) → {Promise.<string>}

Get the current stream position. API Endpoint: '/events' Method: GET
Parameters:
Name Type Attributes Description
callback function <optional>
Passed the current stream position if successful
Source:
Returns:
A promise resolving to the stream position
Type
Promise.<string>

getCurrentStreamPosition(callbackopt) → {Promise.<string>}

Get the current stream position. API Endpoint: '/events' Method: GET
Parameters:
Name Type Attributes Description
callback function <optional>
Passed the current stream position if successful
Source:
Returns:
A promise resolving to the stream position
Type
Promise.<string>

getEnterpriseEventStream(optionsopt, callbackopt) → {Promise.<EnterpriseEventStream>}

Create a stream of enterprise events. By default, the stream starts from the current time. Pass 'startDate' to start from a specific time. Pass 'streamPosition' to start from a previous stream position, or '0' for all available past events (~1 year). Once the stream catches up to the current time, it will begin polling every 'pollingInterval' seconds. If 'pollingInterval' = 0, then the stream will end when it catches up to the current time (no polling). By default, stream pools `admin_logs` for events. The emphasis for this stream is on completeness over latency, which means that Box will deliver admin events in chronological order and without duplicates, but with higher latency. You can specify start and end time/dates. To monitor recent events that have been generated within Box across the enterprise use `admin_logs_streaming` as stream type. The emphasis for this feed is on low latency rather than chronological accuracy, which means that Box may return events more than once and out of chronological order. Events are returned via the API around 12 seconds after they are processed by Box (the 12 seconds buffer ensures that new events are not written after your cursor position). Only two weeks of events are available via this feed, and you cannot set start and end time/dates. This method will only work with an API connection for an enterprise admin account or service account with a manage enterprise properties.
Parameters:
Name Type Attributes Description
options Object <optional>
Options
Properties
Name Type Attributes Default Description
streamPosition string <optional>
The stream position to start from (pass '0' for all past events)
startDate string <optional>
The date to start from
endDate string <optional>
The date to end at
eventTypeFilter Array.<EventType> <optional>
Array of event types to return
pollingInterval int <optional>
60 Polling interval (in seconds). Pass 0 for no polling.
chunkSize int <optional>
500 Number of events to fetch per call (max = 500)
streamType string <optional>
From which stream events should be selected. Possible values are `admin_logs` and `admin_logs_streaming`
callback function <optional>
Passed the events stream if successful
Source:
Returns:
A promise resolving to the enterprise event stream
Type
Promise.<EnterpriseEventStream>

getEnterpriseEventStream(optionsopt, callbackopt) → {Promise.<EnterpriseEventStream>}

Create a stream of enterprise events. By default, the stream starts from the current time. Pass 'startDate' to start from a specific time. Pass 'streamPosition' to start from a previous stream position, or '0' for all available past events (~1 year). Once the stream catches up to the current time, it will begin polling every 'pollingInterval' seconds. If 'pollingInterval' = 0, then the stream will end when it catches up to the current time (no polling). By default, stream pools `admin_logs` for events. The emphasis for this stream is on completeness over latency, which means that Box will deliver admin events in chronological order and without duplicates, but with higher latency. You can specify start and end time/dates. To monitor recent events that have been generated within Box across the enterprise use `admin_logs_streaming` as stream type. The emphasis for this feed is on low latency rather than chronological accuracy, which means that Box may return events more than once and out of chronological order. Events are returned via the API around 12 seconds after they are processed by Box (the 12 seconds buffer ensures that new events are not written after your cursor position). Only two weeks of events are available via this feed, and you cannot set start and end time/dates. This method will only work with an API connection for an enterprise admin account or service account with a manage enterprise properties.
Parameters:
Name Type Attributes Description
options Object <optional>
Options
Properties
Name Type Attributes Default Description
streamPosition string <optional>
The stream position to start from (pass '0' for all past events)
startDate string <optional>
The date to start from
endDate string <optional>
The date to end at
eventTypeFilter Array.<EventType> <optional>
Array of event types to return
pollingInterval int <optional>
60 Polling interval (in seconds). Pass 0 for no polling.
chunkSize int <optional>
500 Number of events to fetch per call (max = 500)
streamType string <optional>
From which stream events should be selected. Possible values are `admin_logs` and `admin_logs_streaming`
callback function <optional>
Passed the events stream if successful
Source:
Returns:
A promise resolving to the enterprise event stream
Type
Promise.<EnterpriseEventStream>

getEventStream(streamPositionopt, optionsopt, callbackopt) → {Promise.<EventStream>}

Create a stream of events, using the long-poll API to wait for new events. API Endpoint: '/events' Method: OPTIONS
Parameters:
Name Type Attributes Description
streamPosition string <optional>
Starting stream position
options Object <optional>
Optional parameters for the event stream
Properties
Name Type Attributes Default Description
retryDelay int <optional>
1000 Number of ms to wait before retrying after an error
deduplicationFilterSize int <optional>
5000 Number of IDs to track for deduplication
fetchInterval int <optional>
1000 Minimunm number of ms between calls for more events
callback function <optional>
Passed the events stream if successful
Source:
Returns:
A promise resolving to the event stream
Type
Promise.<EventStream>

getEventStream(streamPositionopt, optionsopt, callbackopt) → {Promise.<EventStream>}

Create a stream of events, using the long-poll API to wait for new events. API Endpoint: '/events' Method: OPTIONS
Parameters:
Name Type Attributes Description
streamPosition string <optional>
Starting stream position
options Object <optional>
Optional parameters for the event stream
Properties
Name Type Attributes Default Description
retryDelay int <optional>
1000 Number of ms to wait before retrying after an error
deduplicationFilterSize int <optional>
5000 Number of IDs to track for deduplication
fetchInterval int <optional>
1000 Minimunm number of ms between calls for more events
callback function <optional>
Passed the events stream if successful
Source:
Returns:
A promise resolving to the event stream
Type
Promise.<EventStream>

getLongPollInfo(callbackopt) → {Promise.<Object>}

Get information for long-polling until new events are available API Endpoint: '/events' Method: OPTIONS
Parameters:
Name Type Attributes Description
callback function <optional>
Passed the long poll info if successful
Source:
Returns:
A promise resolving to the long poll info
Type
Promise.<Object>

getLongPollInfo(callbackopt) → {Promise.<Object>}

Get information for long-polling until new events are available API Endpoint: '/events' Method: OPTIONS
Parameters:
Name Type Attributes Description
callback function <optional>
Passed the long poll info if successful
Source:
Returns:
A promise resolving to the long poll info
Type
Promise.<Object>