Details
| ID | Box v2 |
|---|---|
| Provider | Box |
| Category | IT Services |
| From Version | 5.0.0 |
| Docker Image | demisto/auth-utils:1.0.0.10133006 |
| Supported Modules | Agentix XSIAM |
README
Manage Box users
This integration was integrated and tested with API version 2.0 of Box v2
Configure the Box Application to Interface with XSOAR
- Navigate to the developer console for Box.
- Click Create a New App.
- Select Custom App and when prompted, select Server Authentication (with JWT)
- Enter your desired App Name.
- In the Configuration menu under Application Access, select Enterprise.
- Under the Advanced Features option, enable both Perform Actions as Users and Generate User Access Tokens.
- In the Add and Manage Public Keys section, click Generate a Public/Private Keypair and follow the prompts.
- Click Save Changes in the upper right-hand corner.
- Navigate to the bottom of the page and select Download as a JSON.
Once you have obtained the JSON file, copy and paste its contents into the Credentials JSON parameter.
Before testing the integration, navigate to the General Settings for your app in the developer console and click
Review and Submit. Your enterprise admin will need to approve the app before your integration will start working.
From the General Settings menu, you may also obtain your User ID for the service account.
Configure Box v2 on Cortex XSOAR
- Navigate to Settings > Integrations > Servers & Services.
- Search for Box v2.
-
Click Add instance to create and configure a new integration instance.
Parameter Description Required insecure Trust any certificate (not secure) False credentials_json Credentials JSON True as_user As User for Fetching Incidents False event_type False default_user Default User False search_user_id Auto-detect user IDs based on their email address. False incidentType Incident type False isFetch Fetch incidents False first_fetch First fetch timestamp ( <number><time unit>, e.g., 12 hours, 7 days)False max_fetch False - Click Test to validate the URLs, token, and connection.
Differences between Box (Deprecated) and Box v2
- Context outputs were changed to be nested under the entity type for each command. For example, user outputs
used to be stored under the context root, Box. In this version they are stored under the entity Box.Users. - Authentication is handled via JSON Web Tokens (JWT) and no longer requires each command to retrieve an authentication
token manually. - All results given via the Box API is returned into the context.
Commands
You can execute these commands from the Cortex XSOAR CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.
box-search-content
Searches for files, folders, web links, and shared files across the users content or across the entire enterprise.
Base Command
box-search-content
Input
| Argument Name | Description | Required |
|---|---|---|
| type | Limits the search results to any items of this type. This parameter only takes one value. By default the API returns items that match any of these types. Possible values are: file, folder, web_link. | Optional |
| ancestor_folder_ids | A comma-separated lists of folder IDs that limits the search results to items within the given list of folders. | Optional |
| item_name | Query for an item by name. | Optional |
| item_description | The description of the item to search for. | Optional |
| comments | The comments of the item to search for. | Optional |
| tag | The tag of the item to search for. | Optional |
| created_range | A comma-separated list of the time frame of when the item was created. Can be RFC3339 timestamps, or relative to the current time (e.g., 3 Days). | Optional |
| file_extensions | Limits the search results to any files that match any of the provided file extensions. | Optional |
| limit | The maximum number of items to return as part of a page of results. Default is “100”. | Optional |
| offset | The offset of the item at which to begin the response. Default is “0”. | Optional |
| owner_uids | A comma-separated list of user IDs used to limit the search results to any items that are owned by the given list of owners. | Optional |
| trash_content | Whether the search should look in the trash for items. | Optional |
| updated_at_range | Limits the search results to any items updated within a given date range. | Optional |
| query | The string to search for. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Query.id | Number | The ID of the item found. |
| Box.Query.etag | Number | The entry tag for the item found. |
| Box.Query.type | String | The type of the item found. |
| Box.Query.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Query.name | String | The name of the item. |
| Box.Query.sha1 | String | The SHA1 hash of the item. |
| Box.Query.file_version.id | Number | The unique identifier that represent a file version. |
| Box.Query.file_version.type | String | Value is always file_version. |
| Box.Query.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.Query.description | String | The description of the item. |
| Box.Query.size | Number | The file size in bytes. |
| Box.Query.path_collection.total_count | Number | The number of folders in the list. |
| Box.Query.path_collection.entries.id | Number | The ID of the item found. |
| Box.Query.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.Query.path_collection.entries.type | String | The type of the item found. |
| Box.Query.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Query.path_collection.entries.name | String | The name of the item. |
| Box.Query.created_at | Date | The date and time when the item was created on Box. |
| Box.Query.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.Query.trashed_at | Date | The time at which the item was put in the trash. |
| Box.Query.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.Query.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.Query.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.Query.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.Query.created_by.type | String | Value is always user. |
| Box.Query.created_by.name | String | The display name of the user who created the item. |
| Box.Query.created_by.login | String | The primary email address of the user who created the item. |
| Box.Query.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.Query.modified_by.type | String | Value is always user. |
| Box.Query.modified_by.name | String | The display name of the user who modified the item. |
| Box.Query.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.Query.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.Query.owned_by.type | String | Value is always user. |
| Box.Query.owned_by.name | String | The display name of the user who owns the item. |
| Box.Query.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.Query.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.Query.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.Query.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.Query.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.Query.entries.shared_link.access | String | The access level for the shared link. |
| Box.Query.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.Query.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.Query.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.Query.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.Query.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.Query.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.Query.entries.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.Query.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.Query.parent.id | Number | The ID of the parent for the item found |
| Box.Query.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.Query.parent.type | String | The type for the parent of the item found. |
| Box.Query.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.Query.parent.name | String | The name of the parent of the item. |
| Box.Query.item_status | String | The status of the parent of the item. |
Command Example
!box-search-content item_name="test" limit="1"
Context Example
{
"Box": {
"Query": {
"content_created_at": "2020-11-30T03:53:45-08:00",
"content_modified_at": "2020-11-30T03:53:45-08:00",
"created_at": "2020-11-30T03:53:45-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"folder_upload_email": null,
"id": "127109452066",
"item_status": "active",
"modified_at": "2020-11-30T03:53:45-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "test-demo name",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"shared_link": null,
"size": 0,
"trashed_at": null,
"type": "folder"
}
}
}
Human Readable Output
Search results
Content Created At Content Modified At Created At Created By Etag Id Item Status Modified At Modified By Name Owned By Parent Path Collection Sequence Id Size Type 2020-11-30T03:53:45-08:00 2020-11-30T03:53:45-08:00 2020-11-30T03:53:45-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com0 127109452066 active 2020-11-30T03:53:45-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comtest-demo name type: user
id: 14342567114
name: Jane Doe
login: test@test.comtype: folder
id: 0
sequence_id: null
etag: null
name: All Filestotal_count: 1
entries: {‘type’: ‘folder’, ‘id’: ‘0’, ‘sequence_id’: None, ‘etag’: None, ‘name’: ‘All Files’}0 0 folder
box-find-file-folder-by-share-link
Return the file represented by a shared link.
Base Command
box-find-file-folder-by-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| shared_link | Linked used to share the file. | Required |
| password | Password used to access the shared link. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | Number | The ID of the item found. |
| Box.ShareLink.etag | Number | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.ShareLink.name | String | The name of the item. |
| Box.ShareLink.sha1 | String | The SHA1 hash of the item. |
| Box.ShareLink.file_version.id | Number | The unique identifier that represent a file version. |
| Box.ShareLink.file_version.type | String | Value is always file_version. |
| Box.ShareLink.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.ShareLink.description | String | The description of the item. |
| Box.ShareLink.size | Number | The file size in bytes. |
| Box.ShareLink.path_collection.total_count | Number | The number of folders in the list. |
| Box.ShareLink.path_collection.entries.id | Number | The ID of the item found. |
| Box.ShareLink.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.ShareLink.path_collection.entries.type | String | The type of the item found. |
| Box.ShareLink.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.ShareLink.path_collection.entries.name | String | The name of the item. |
| Box.ShareLink.created_at | Date | The date and time when the item was created on Box. |
| Box.ShareLink.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.ShareLink.trashed_at | Date | The time at which the item was put in the trash. |
| Box.ShareLink.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.ShareLink.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.ShareLink.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.ShareLink.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.ShareLink.created_by.type | String | Value is always user. |
| Box.ShareLink.created_by.name | String | The display name of the user who created the item. |
| Box.ShareLink.created_by.login | String | The primary email address of the user who created the item. |
| Box.ShareLink.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.ShareLink.modified_by.type | String | Value is always user. |
| Box.ShareLink.modified_by.name | String | The display name of the user who modified the item. |
| Box.ShareLink.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.ShareLink.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.ShareLink.owned_by.type | String | Value is always user. |
| Box.ShareLink.owned_by.name | String | The display name of the user who owns the item. |
| Box.ShareLink.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.ShareLink.parent.id | Number | The ID of the parent for the item found |
| Box.ShareLink.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.ShareLink.parent.type | String | The type for the parent of the item found. |
| Box.ShareLink.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.ShareLink.parent.name | String | The name of the parent of the item. |
| Box.ShareLink.item_status | String | The status of the parent of the item. |
Command Example
!box-find-file-folder-by-share-link shared_link="https://app.box.com/s/oyujr5qpxy1nbky394slw7n98v8pnpmy"
Context Example
{
"Box": {
"ShareLink": {
"content_created_at": "2020-11-25T05:20:55-08:00",
"content_modified_at": "2020-11-25T05:20:55-08:00",
"created_at": "2020-11-25T05:20:56-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "2",
"file_version": {
"id": "794731944502",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745868717302",
"item_status": "active",
"modified_at": "2020-12-01T06:28:21-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "55555.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": null,
"path_collection": {
"entries": [],
"total_count": 0
},
"purged_at": null,
"sequence_id": "2",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"trashed_at": null,
"type": "file"
}
}
}
Human Readable Output
File/Folder Share Link for
https://app.box.com/s/oyujr5qpxy1nbky394slw7n98v8pnpmy
Content Created At Content Modified At Created At Created By Etag File Version Id Item Status Modified At Modified By Name Owned By Path Collection Sequence Id Sha1 Size Type 2020-11-25T05:20:55-08:00 2020-11-25T05:20:55-08:00 2020-11-25T05:20:56-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com2 type: file_version
id: 794731944502
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f745868717302 active 2020-12-01T06:28:21-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com55555.gif type: user
id: 14342567114
name: Jane Doe
login: test@test.comtotal_count: 0
entries:2 1ff8be1766d9e16b0b651f89001e8e7375c9e71f 26891788 file
box-get-shared-link-by-file
Gets the information for a shared link on a file.
Base Command
box-get-shared-link-by-file
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The unique identifier that represent a file. | Required |
| as_user | The user ID for the account used to access the file. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-get-shared-link-by-file file_id="742246263170" as_user="14342567114"
Context Example
{
"Box": {
"ShareLink": {
"etag": "17",
"id": "742246263170",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": "https://app.box.com/shared/static/khro4bw4g6ay68ye70gsnisqsp9c9r23.jpeg",
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/khro4bw4g6ay68ye70gsnisqsp9c9r23",
"vanity_name": null,
"vanity_url": null
},
"type": "file"
}
}
}
Human Readable Output
Shared link information for the file 742246263170
Access Download Count Download Url Effective Access Effective Permission Is Password Enabled Permissions Preview Count Url open 0 https://app.box.com/shared/static/khro4bw4g6ay68ye70gsnisqsp9c9r23.jpegopen can_preview false can_preview: true
can_download: false0 https://app.box.com/s/khro4bw4g6ay68ye70gsnisqsp9c9r23
box-create-file-share-link
Adds a shared link to a file.
Base Command
box-create-file-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The unique identifier that represent a file. | Optional |
| access | The level of access for the shared link. Possible values are: open, company, collaborators. | Optional |
| password | The password required to access the shared link. | Optional |
| unshared_at | The timestamp at which this shared link will expire. | Optional |
| can_download | If the shared link allows for downloading of files. Possible values are: true, false. | Optional |
| as_user | The user who is making the request. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | Number | The ID of the item found. |
| Box.ShareLink.etag | Number | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-create-file-share-link file_id="742246263170" access="open" as_user="14342567114"
Context Example
{
"Box": {
"ShareLink": {
"etag": "17",
"id": "742246263170",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": "https://app.box.com/shared/static/khro4bw4g6ay68ye70gsnisqsp9c9r23.jpeg",
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/khro4bw4g6ay68ye70gsnisqsp9c9r23",
"vanity_name": null,
"vanity_url": null
},
"type": "file"
}
}
}
Human Readable Output
File Share Link was created/updated for file_id: 742246263170
Access Download Count Download Url Effective Access Effective Permission Is Password Enabled Permissions Preview Count Url open 0 https://app.box.com/shared/static/khro4bw4g6ay68ye70gsnisqsp9c9r23.jpegopen can_preview false can_preview: true
can_download: false0 https://app.box.com/s/khro4bw4g6ay68ye70gsnisqsp9c9r23
box-update-file-share-link
Updates a shared link on a file.
Base Command
box-update-file-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| access | The level of access for the shared link. Possible values are: open, company, collaborators. | Optional |
| password | The password required to access the shared link. | Optional |
| unshared_at | The timestamp at which this shared link will expire. | Optional |
| can_download | If the shared link allows for downloading of files. Possible values are: true, false. | Optional |
| file_id | The unique identifier that represent a file. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | Number | The ID of the item found. |
| Box.ShareLink.etag | Number | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-update-file-share-link file_id="742246263170" as_user="14342567114"
Context Example
{
"Box": {
"ShareLink": {
"etag": "19",
"id": "742246263170",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": "https://app.box.com/shared/static/g3xy2he56jd2hfakjv5ptik08de8v15f.jpeg",
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/g3xy2he56jd2hfakjv5ptik08de8v15f",
"vanity_name": null,
"vanity_url": null
},
"type": "file"
}
}
}
Human Readable Output
File Share Link was created/updated for file_id: 742246263170
Access Download Count Download Url Effective Access Effective Permission Is Password Enabled Permissions Preview Count Url open 0 https://app.box.com/shared/static/g3xy2he56jd2hfakjv5ptik08de8v15f.jpegopen can_preview false can_preview: true
can_download: false0 https://app.box.com/s/g3xy2he56jd2hfakjv5ptik08de8v15f
box-remove-file-share-link
Removes a shared link from a file.
Base Command
box-remove-file-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The unique identifier that represents a file. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
Command Example
!box-remove-file-share-link file_id="742246263170" as_user="test@test.com"
Context Example
{
"Box": {
"ShareLink": {
"etag": "18",
"id": "742246263170",
"shared_link": null,
"type": "file"
}
}
}
Human Readable Output
File Share Link for the file_id 742246263170 was removed.
box-get-shared-link-by-folder
Gets the information for a shared link on a folder.
Base Command
box-get-shared-link-by-folder
Input
| Argument Name | Description | Required |
|---|---|---|
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-get-shared-link-by-folder folder_id="125959916474" as_user="14342567114"
Context Example
{
"Box": {
"FolderShareLink": {
"etag": "0",
"id": "125959916474",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": null,
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/qmfynlq5bpaq5cn7nnbet8vh9nnsswqi",
"vanity_name": null,
"vanity_url": null
},
"type": "folder"
}
}
}
Human Readable Output
Shared link information for the folder 125959916474
Etag Id Shared Link Type 0 125959916474 url: https://app.box.com/s/qmfynlq5bpaq5cn7nnbet8vh9nnsswqi
download_url: null
vanity_url: null
vanity_name: null
effective_access: open
effective_permission: can_preview
is_password_enabled: false
unshared_at: null
download_count: 0
preview_count: 0
access: open
permissions: {“can_preview”: true, “can_download”: false}folder
box-create-folder-share-link
Adds a shared link to a folder.
Base Command
box-create-folder-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| access | The level of access for the shared link. Possible values are: open, company, collaborators. | Optional |
| password | The password required to access the shared link. | Optional |
| unshared_at | The timestamp at which this shared link will expire. | Optional |
| can_download | If the shared link allows for downloading of folders. Possible values are: true, false. | Optional |
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-create-folder-share-link folder_id="125959916474" as_user="14342567114"
Context Example
{
"Box": {
"ShareLink": {
"etag": "0",
"id": "125959916474",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": null,
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/qmfynlq5bpaq5cn7nnbet8vh9nnsswqi",
"vanity_name": null,
"vanity_url": null
},
"type": "folder"
}
}
}
Human Readable Output
Folder Share Link for 125959916474
Etag Id Shared Link Type 0 125959916474 url: https://app.box.com/s/qmfynlq5bpaq5cn7nnbet8vh9nnsswqi
download_url: null
vanity_url: null
vanity_name: null
effective_access: open
effective_permission: can_preview
is_password_enabled: false
unshared_at: null
download_count: 0
preview_count: 0
access: open
permissions: {“can_preview”: true, “can_download”: false}folder
box-update-folder-share-link
Updates a shared link on a folder.
Base Command
box-update-folder-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
| access | The level of access for the shared link. Possible values are: open, company, collaborators. | Optional |
| password | The password required to access the shared link. | Optional |
| unshared_at | The timestamp at which this shared link will expire. | Optional |
| can_download | If the shared link allows for downloading of folders. Possible values are: true, false. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.entries.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
Command Example
!box-update-folder-share-link folder_id="125959916474" as_user="14342567114" access="open" can_download="false"
Context Example
{
"Box": {
"ShareLink": {
"etag": "0",
"id": "125959916474",
"shared_link": {
"access": "open",
"download_count": 0,
"download_url": null,
"effective_access": "open",
"effective_permission": "can_preview",
"is_password_enabled": false,
"permissions": {
"can_download": false,
"can_preview": true
},
"preview_count": 0,
"unshared_at": null,
"url": "https://app.box.com/s/uaigc08phyoxnx59nlllecax7mfsrfb1",
"vanity_name": null,
"vanity_url": null
},
"type": "folder"
}
}
}
Human Readable Output
Folder Share Link for 125959916474
Etag Id Shared Link Type 0 125959916474 url: https://app.box.com/s/uaigc08phyoxnx59nlllecax7mfsrfb1
download_url: null
vanity_url: null
vanity_name: null
effective_access: open
effective_permission: can_preview
is_password_enabled: false
unshared_at: null
download_count: 0
preview_count: 0
access: open
permissions: {“can_preview”: true, “can_download”: false}folder
box-remove-folder-share-link
Removes a shared link from a folder.
Base Command
box-remove-folder-share-link
Input
| Argument Name | Description | Required |
|---|---|---|
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | String | The ID of the item found. |
| Box.ShareLink.etag | String | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
Command Example
!box-remove-folder-share-link folder_id="125959916474" as_user="test@test.com"
Context Example
{
"Box": {
"ShareLink": {
"etag": "0",
"id": "125959916474",
"shared_link": null,
"type": "folder"
}
}
}
Human Readable Output
Folder Share Link for 125959916474 was removed
Etag Id Type 0 125959916474 folder
box-get-folder
Retrieves details for a folder, including the first 100 entries in the folder.
Base Command
box-get-folder
Input
| Argument Name | Description | Required |
|---|---|---|
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.ShareLink.id | Number | The ID of the item found. |
| Box.ShareLink.etag | Number | The entry tag for the item found. |
| Box.ShareLink.type | String | The type of the item found. |
| Box.ShareLink.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.ShareLink.name | String | The name of the item. |
| Box.ShareLink.sha1 | String | The SHA1 hash of the item. |
| Box.ShareLink.file_version.id | Number | The unique identifier that represent a file version. |
| Box.ShareLink.file_version.type | String | Value is always file_version. |
| Box.ShareLink.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.ShareLink.description | String | The description of the item. |
| Box.ShareLink.size | Number | The file size in bytes. |
| Box.ShareLink.path_collection.total_count | Number | The number of folders in the list. |
| Box.ShareLink.path_collection.entries.id | Number | The ID of the item found. |
| Box.ShareLink.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.ShareLink.path_collection.entries.type | String | The type of the item found. |
| Box.ShareLink.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.ShareLink.path_collection.entries.name | String | The name of the item. |
| Box.ShareLink.created_at | Date | The date and time when the item was created on Box. |
| Box.ShareLink.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.ShareLink.trashed_at | Date | The time at which the item was put in the trash. |
| Box.ShareLink.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.ShareLink.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.ShareLink.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.ShareLink.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.ShareLink.created_by.type | String | Value is always user. |
| Box.ShareLink.created_by.name | String | The display name of the user who created the item. |
| Box.ShareLink.created_by.login | String | The primary email address of the user who created the item. |
| Box.ShareLink.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.ShareLink.modified_by.type | String | Value is always user. |
| Box.ShareLink.modified_by.name | String | The display name of the user who modified the item. |
| Box.ShareLink.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.ShareLink.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.ShareLink.owned_by.type | String | Value is always user. |
| Box.ShareLink.owned_by.name | String | The display name of the user who owns the item. |
| Box.ShareLink.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.ShareLink.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.ShareLink.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.ShareLink.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.ShareLink.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.ShareLink.shared_link.access | String | The access level for the shared link. |
| Box.ShareLink.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.ShareLink.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.ShareLink.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.ShareLink.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.ShareLink.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.ShareLink.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.ShareLink.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.ShareLink.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.ShareLink.parent.id | Number | The ID of the parent for the item found |
| Box.ShareLink.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.ShareLink.parent.type | String | The type for the parent of the item found. |
| Box.ShareLink.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.ShareLink.parent.name | String | The name of the parent of the item. |
| Box.ShareLink.item_status | String | The status of the parent of the item. |
Command Example
!box-get-folder folder_id="0" as_user="14342567114"
Context Example
{
"Box": {
"Folder": {
"content_created_at": null,
"content_modified_at": null,
"created_at": null,
"created_by": {
"id": "",
"login": "",
"name": "",
"type": "user"
},
"description": "",
"etag": null,
"folder_upload_email": null,
"id": "0",
"item_collection": {
"entries": [
{
"etag": "0",
"id": "125959916474",
"name": "My Box Notes",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "128036492321",
"name": "Sample Folder for Docs",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "126452434994",
"name": "Sample Testing Folder",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127912817927",
"name": "Sample Testing Folder 2",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "126469445717",
"name": "Sample Testing Folder test",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127304720432",
"name": "Sample Testing Folder test1",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127109452066",
"name": "test-demo name",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "2",
"file_version": {
"id": "794731944502",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745868717302",
"name": "55555.gif",
"sequence_id": "2",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "802646696736",
"sha1": "f401d87fa1cc4f96a357c564bf0de2e19ccf9d1f",
"type": "file_version"
},
"id": "752998071936",
"name": "customers.jpg",
"sequence_id": "0",
"sha1": "f401d87fa1cc4f96a357c564bf0de2e19ccf9d1f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794713426050",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745851995250",
"name": "image.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794716642653",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745854929853",
"name": "image1.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794719141622",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745857164822",
"name": "image2.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794721102684",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745859107884",
"name": "image3.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794733314512",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745870218112",
"name": "image4.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794736891054",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745873525854",
"name": "image6_please_work.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "2",
"file_version": {
"id": "792056280660",
"sha1": "533a85c782614a6dfe19b83f7d628466ceb00c39",
"type": "file_version"
},
"id": "743439873060",
"name": "new-devs-touching-the-build.gif",
"sequence_id": "2",
"sha1": "533a85c782614a6dfe19b83f7d628466ceb00c39",
"type": "file"
},
{
"etag": "5",
"file_version": {
"id": "794764999514",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file_version"
},
"id": "745898898314",
"name": "testing event1234.gif",
"sequence_id": "5",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file"
},
{
"etag": "3",
"file_version": {
"id": "803108695891",
"sha1": "30d8caa24c8526fa13d80e489ea16ff544d988db",
"type": "file_version"
},
"id": "753421883491",
"name": "vandijk5.gif",
"sequence_id": "3",
"sha1": "30d8caa24c8526fa13d80e489ea16ff544d988db",
"type": "file"
}
],
"limit": 100,
"offset": 0,
"order": [
{
"by": "type",
"direction": "ASC"
},
{
"by": "name",
"direction": "ASC"
}
],
"total_count": 18
},
"item_status": "active",
"modified_at": null,
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "All Files",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": null,
"path_collection": {
"entries": [],
"total_count": 0
},
"purged_at": null,
"sequence_id": null,
"shared_link": null,
"size": 212311360,
"trashed_at": null,
"type": "folder"
}
}
}
Human Readable Output
Folder overview for 0
Created By Id Item Status Modified By Name Owned By Path Collection Size Type type: user
id:
name:
login:0 active type: user
id: 14342567114
name: Jane Doe
login: test@test.comAll Files type: user
id: 14342567114
name: Jane Doe
login: test@test.comtotal_count: 0
entries:212311360 folder File contents for the folder 0
Etag Id Name Sequence Id Type 0 125959916474 My Box Notes 0 folder 0 128036492321 Sample Folder for Docs 0 folder 0 126452434994 Sample Testing Folder 0 folder 0 127912817927 Sample Testing Folder 2 0 folder 0 126469445717 Sample Testing Folder test 0 folder 0 127304720432 Sample Testing Folder test1 0 folder 0 127109452066 test-demo name 0 folder 2 745868717302 55555.gif 2 file 0 752998071936 customers.jpg 0 file 0 745851995250 image.gif 0 file 0 745854929853 image1.gif 0 file 0 745857164822 image2.gif 0 file 0 745859107884 image3.gif 0 file 0 745870218112 image4.gif 0 file 0 745873525854 image6_please_work.gif 0 file 2 743439873060 new-devs-touching-the-build.gif 2 file 5 745898898314 testing event1234.gif 5 file 3 753421883491 vandijk5.gif 3 file
box-list-folder-items
Retrieves a page of items in a folder.
Base Command
box-list-folder-items
Input
| Argument Name | Description | Required |
|---|---|---|
| folder_id | The unique identifier that represent a folder. | Required |
| as_user | The user who is performing the action. | Optional |
| limit | The maximum number of items to return per page. Default is “100”. | Optional |
| offset | The offset of the item at which to begin the response. Default is “0”. | Optional |
| sort | The field the results should be sorted by. Possible values are: id, name, date, size. Default is name. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Folder.id | Number | The ID of the folder. |
| Box.Folder.etag | Number | The entity tag of the folder. |
| Box.Folder.type | String | Value is always `folder`. |
| Box.Folder.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Folder.name | String | The name of the folder. |
| Box.Folder.sha1 | String | The SHA1 has of the folder. |
| Box.Folder.file_version.id | Number | The unique identifier that represent a file version. |
| Box.Folder.file_version.type | String | Value is always file_version. |
| Box.Folder.file_version.sha1 | String | The SHA1 hash of this version of the file. |
Command Example
!box-list-folder-items folder_id="0" as_user="test@test.com"
Context Example
{
"Box": {
"Folder": {
"content_created_at": null,
"content_modified_at": null,
"created_at": null,
"created_by": {
"id": "",
"login": "",
"name": "",
"type": "user"
},
"description": "",
"etag": null,
"folder_upload_email": null,
"id": "0",
"item_collection": {
"entries": [
{
"etag": "0",
"id": "125959916474",
"name": "My Box Notes",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "128036492321",
"name": "Sample Folder for Docs",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "126452434994",
"name": "Sample Testing Folder",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127912817927",
"name": "Sample Testing Folder 2",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "126469445717",
"name": "Sample Testing Folder test",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127304720432",
"name": "Sample Testing Folder test1",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "0",
"id": "127109452066",
"name": "test-demo name",
"sequence_id": "0",
"type": "folder"
},
{
"etag": "2",
"file_version": {
"id": "794731944502",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745868717302",
"name": "55555.gif",
"sequence_id": "2",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "802646696736",
"sha1": "f401d87fa1cc4f96a357c564bf0de2e19ccf9d1f",
"type": "file_version"
},
"id": "752998071936",
"name": "customers.jpg",
"sequence_id": "0",
"sha1": "f401d87fa1cc4f96a357c564bf0de2e19ccf9d1f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794713426050",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745851995250",
"name": "image.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794716642653",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745854929853",
"name": "image1.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794719141622",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745857164822",
"name": "image2.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794721102684",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745859107884",
"name": "image3.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794733314512",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745870218112",
"name": "image4.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "0",
"file_version": {
"id": "794736891054",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745873525854",
"name": "image6_please_work.gif",
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file"
},
{
"etag": "2",
"file_version": {
"id": "792056280660",
"sha1": "533a85c782614a6dfe19b83f7d628466ceb00c39",
"type": "file_version"
},
"id": "743439873060",
"name": "new-devs-touching-the-build.gif",
"sequence_id": "2",
"sha1": "533a85c782614a6dfe19b83f7d628466ceb00c39",
"type": "file"
},
{
"etag": "5",
"file_version": {
"id": "794764999514",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file_version"
},
"id": "745898898314",
"name": "testing event1234.gif",
"sequence_id": "5",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file"
},
{
"etag": "3",
"file_version": {
"id": "803108695891",
"sha1": "30d8caa24c8526fa13d80e489ea16ff544d988db",
"type": "file_version"
},
"id": "753421883491",
"name": "vandijk5.gif",
"sequence_id": "3",
"sha1": "30d8caa24c8526fa13d80e489ea16ff544d988db",
"type": "file"
}
],
"limit": 100,
"offset": 0,
"order": [
{
"by": "type",
"direction": "ASC"
},
{
"by": "name",
"direction": "ASC"
}
],
"total_count": 18
},
"item_status": "active",
"modified_at": null,
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "All Files",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": null,
"path_collection": {
"entries": [],
"total_count": 0
},
"purged_at": null,
"sequence_id": null,
"shared_link": null,
"size": 212311360,
"trashed_at": null,
"type": "folder"
}
}
}
Human Readable Output
Folder overview for 0
Created By Id Item Status Modified By Name Owned By Path Collection Size Type type: user
id:
name:
login:0 active type: user
id: 14342567114
name: Jane Doe
login: test@test.comAll Files type: user
id: 14342567114
name: Jane Doe
login: test@test.comtotal_count: 0
entries:212311360 folder File contents for the folder 0
Etag Id Name Sequence Id Type 0 125959916474 My Box Notes 0 folder 0 128036492321 Sample Folder for Docs 0 folder 0 126452434994 Sample Testing Folder 0 folder 0 127912817927 Sample Testing Folder 2 0 folder 0 126469445717 Sample Testing Folder test 0 folder 0 127304720432 Sample Testing Folder test1 0 folder 0 127109452066 test-demo name 0 folder 2 745868717302 55555.gif 2 file 0 752998071936 customers.jpg 0 file 0 745851995250 image.gif 0 file 0 745854929853 image1.gif 0 file 0 745857164822 image2.gif 0 file 0 745859107884 image3.gif 0 file 0 745870218112 image4.gif 0 file 0 745873525854 image6_please_work.gif 0 file 2 743439873060 new-devs-touching-the-build.gif 2 file 5 745898898314 testing event1234.gif 5 file 3 753421883491 vandijk5.gif 3 file
box-folder-create
Creates a new empty folder within the specified parent folder.
Base Command
box-folder-create
Input
| Argument Name | Description | Required |
|---|---|---|
| name | The name for the new folder. | Required |
| parent_id | The parent folder to create the new folder within. Default is 0. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Folder.id | Number | The ID of the folder created. |
| Box.Folder.etag | Number | The entry tag for the folder created. |
| Box.Folder.type | String | The type of folder. |
| Box.Folder.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the folder. |
| Box.Folder.name | String | The name of the folder. |
| Box.Folder.sha1 | String | The SHA1 hash of the folder. |
| Box.Folder.file_version.id | Number | The unique identifier that represents a file version. |
| Box.Folder.file_version.type | String | Value is always file_version. |
| Box.Folder.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.Folder.description | String | The description of the item. |
| Box.Folder.size | Number | The folder size in bytes. |
| Box.Folder.path_collection.total_count | Number | The number of folders in the list. |
| Box.Folder.path_collection.entries.id | Number | The ID of the item found. |
| Box.Folder.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.Folder.path_collection.entries.type | String | The type of the item found. |
| Box.Folder.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Folder.path_collection.entries.name | String | The name of the item. |
| Box.Folder.created_at | Date | The date and time when the item was created on Box. |
| Box.Folder.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.Folder.trashed_at | Date | The time at which the item was put in the trash. |
| Box.Folder.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.Folder.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.Folder.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.Folder.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.Folder.created_by.type | String | Value is always user. |
| Box.Folder.created_by.name | String | The display name of the user who created the item. |
| Box.Folder.created_by.login | String | The primary email address of the user who created the item. |
| Box.Folder.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.Folder.modified_by.type | String | Value is always user. |
| Box.Folder.modified_by.name | String | The display name of the user who modified the item. |
| Box.Folder.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.Folder.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.Folder.owned_by.type | String | Value is always user. |
| Box.Folder.owned_by.name | String | The display name of the user who owns the item. |
| Box.Folder.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.Folder.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.Folder.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.Folder.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.Folder.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.Folder.shared_link.access | String | The access level for the shared link. |
| Box.Folder.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.Folder.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.Folder.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.Folder.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.Folder.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.Folder.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.Folder.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.Folder.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.Folder.parent.id | Number | The ID of the parent for the item found |
| Box.Folder.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.Folder.parent.type | String | The type for the parent of the item found. |
| Box.Folder.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.Folder.parent.name | String | The name of the parent of the item. |
| Box.Folder.item_status | String | The status of the parent of the item. |
Command Example
!box-folder-create name="Sample Folder for Docs" parent_id="0" as_user="14342567114"
Context Example
{
"Box": {
"Folder": {
"etag": "0",
"id": "128036492321",
"shared_link": null,
"type": "folder"
}
}
}
Human Readable Output
Folder named Sample Folder for Docs, was successfully created.
box-file-delete
Deletes a file, either permanently or by moving it to the trash.
Base Command
box-file-delete
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The unique identifier that represent a file. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
There is no context output for this command.
Command Example
!box-file-delete file_id="751526132294" as_user="14342567114"
Context Example
{}
Human Readable Output
The file 751526132294 was successfully deleted.
box-list-users
Returns a list of all users for the Enterprise along with their user_id, public_name, and login.
Base Command
box-list-users
Input
| Argument Name | Description | Required |
|---|---|---|
| fields | Attributes to include in the response. Possible values are: id, type, name. | Optional |
| filter_term | Limits the results to only users who’s name or login start with the search term. | Optional |
| limit | The maximum number of items to return per page. Default is “100”. | Optional |
| offset | The offset of the item at which to begin the response. Default is “0”. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.User.id | Number | The unique identifier for this user. |
| Box.User.type | String | Value is always user. |
| Box.User.name | String | The display name of this user. |
| Box.User.login | String | The primary email address of this user. |
| Box.User.created_at | Date | When the user object was created. |
| Box.User.modified_at | Date | When the user object was last modified. |
| Box.User.language | String | The language of the user, formatted in a modified version of the ISO 639-1 format. |
| Box.User.timezone | String | The user’s timezone. |
| Box.User.space_amount | Number | The user’s total available space amount in bytes. |
| Box.User.space_used | Number | The amount of space in use by the user. |
| Box.User.max_upload_size | Number | The maximum individual file size in bytes the user can have. |
| Box.User.status | String | The user’s account status. |
| Box.User.job_title | String | The user’s job title. |
| Box.User.phone | Number | The users phone number. |
| Box.User.address | String | The user’s address. |
| Box.User.avatar_url | String | URL of the user’s avatar image |
| Box.User.notification_email.email | String | The email address to send the notifications to. |
| Box.User.notification_email.is_confirmed | Boolean | Specifies if this email address has been confirmed. |
Command Example
!box-list-users fields=name filter_term="Andrew"
Context Example
{
"Box": {
"Users": {
"id": "14342567114",
"name": "Jane Doe",
"type": "user"
}
}
}
Human Readable Output
The following users were found
Id Name Type 14342567114 Jane Doe user
box-upload-file
Uploads a file to the given folder.
Base Command
box-upload-file
Input
| Argument Name | Description | Required |
|---|---|---|
| entry_id | The entry ID of the file to upload. | Required |
| as_user | The ID of the user who is performing the action. | Optional |
| file_name | The name of the file. | Optional |
| folder_id | The ID of the folder the file is being uploaded to. Default is 0/root. | Required |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.File.id | Number | The ID of the item found. |
| Box.File.etag | Number | The entry tag for the item found. |
| Box.File.type | String | The type of the item found. |
| Box.File.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.File.name | String | The name of the item. |
| Box.File.sha1 | String | The SHA1 hash of the item. |
| Box.File.file_version.id | Number | The unique identifier that represent a file version. |
| Box.File.file_version.type | String | Value is always file_version. |
| Box.File.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.File.description | String | The description of the item. |
| Box.File.size | Number | The file size in bytes. |
| Box.File.path_collection.total_count | Number | The number of folders in the list. |
| Box.File.path_collection.entries.id | Number | The ID of the item found. |
| Box.File.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.File.path_collection.entries.type | String | The type of the item found. |
| Box.File.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.File.path_collection.entries.name | String | The name of the item. |
| Box.File.created_at | Date | The date and time when the item was created on Box. |
| Box.File.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.File.trashed_at | Date | The time at which the item was put in the trash. |
| Box.File.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.File.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.File.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.File.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.File.created_by.type | String | Value is always user. |
| Box.File.created_by.name | String | The display name of the user who created the item. |
| Box.File.created_by.login | String | The primary email address of the user who created the item. |
| Box.File.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.File.modified_by.type | String | Value is always user. |
| Box.File.modified_by.name | String | The display name of the user who modified the item. |
| Box.File.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.File.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.File.owned_by.type | String | Value is always user. |
| Box.File.owned_by.name | String | The display name of the user who owns the item. |
| Box.File.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.File.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.File.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.File.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.File.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.File.shared_link.access | String | The access level for the shared link. |
| Box.File.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.File.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.File.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.File.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.File.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.File.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.File.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.File.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.File.parent.id | Number | The ID of the parent for the item found |
| Box.File.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.File.parent.type | String | The type for the parent of the item found. |
| Box.File.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.File.parent.name | String | The name of the parent of the item. |
| Box.File.item_status | String | The status of the parent of the item. |
Command Example
!box-upload-file entry_id="364@c9316be6-93dc-440a-8c68-c68912590052" folder_id="0" file_name="changelog.json" as_user="14342567114"
Context Example
{}
Human Readable Output
File was successfully uploaded
box-trashed-items-list
Retrieves the files and folders that have been moved to the trash.
Base Command
box-trashed-items-list
Input
| Argument Name | Description | Required |
|---|---|---|
| as_user | The user performing the action. | Optional |
| limit | The maximum number of items to return per page. Default is “100”. | Optional |
| offset | The offset of the item at which to begin the response. Default is “0”. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Trash.id | Number | The ID of the item found. |
| Box.Trash.etag | Number | The entry tag for the item found. |
| Box.Trash.type | String | The type of the item found. |
| Box.Trash.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Trash.name | String | The name of the item. |
| Box.Trash.sha1 | String | The SHA1 hash of the item. |
| Box.Trash.file_version.id | Number | The unique identifier that represent a file version. |
| Box.Trash.file_version.type | String | Value is always file_version. |
| Box.Trash.file_version.sha1 | String | The SHA1 hash of this version of the file. |
Command Example
!box-trashed-items-list as_user="14342567114"
Context Example
{
"Box": {
"Trash": {
"etag": "11",
"file_version": {
"id": "801011020694",
"sha1": "aa58d9692d58f5d9316d7cf1950d19a0b01bc204",
"type": "file_version"
},
"id": "751526132294",
"name": "list.json",
"sequence_id": "11",
"sha1": "aa58d9692d58f5d9316d7cf1950d19a0b01bc204",
"type": "file"
}
}
}
Human Readable Output
Trashed items were found
Etag File Version Id Name Sequence Id Sha1 Type 11 type: file_version
id: 801011020694
sha1: aa58d9692d58f5d9316d7cf1950d19a0b01bc204751526132294 list.json 11 aa58d9692d58f5d9316d7cf1950d19a0b01bc204 file
box-trashed-item-restore
Restores a file or folder that has been moved to the trash.
Base Command
box-trashed-item-restore
Input
| Argument Name | Description | Required |
|---|---|---|
| item_id | The unique identifier that represents the file or folder. | Required |
| type | Type of the object to restore. Possible values are: file, folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Item.id | Number | The ID of the item found. |
| Box.Item.etag | Number | The entry tag for the item found. |
| Box.Item.type | String | The type of the item found. |
| Box.Item.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Item.name | String | The name of the item. |
| Box.Item.sha1 | String | The SHA1 hash of the item. |
| Box.Item.file_version.id | Number | The unique identifier that represent a file version. |
| Box.Item.file_version.type | String | Value is always file_version. |
| Box.Item.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.Item.description | String | The description of the item. |
| Box.Item.size | Number | The file size in bytes. |
| Box.Item.path_collection.total_count | Number | The number of folders in the list. |
| Box.Item.path_collection.entries.id | Number | The ID of the item found. |
| Box.Item.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.Item.path_collection.entries.type | String | The type of the item found. |
| Box.Item.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Item.path_collection.entries.name | String | The name of the item. |
| Box.Item.created_at | Date | The date and time when the item was created on Box. |
| Box.Item.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.Item.trashed_at | Date | The time at which the item was put in the trash. |
| Box.Item.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.Item.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.Item.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.Item.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.Item.created_by.type | String | Value is always user. |
| Box.Item.created_by.name | String | The display name of the user who created the item. |
| Box.Item.created_by.login | String | The primary email address of the user who created the item. |
| Box.Item.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.Item.modified_by.type | String | Value is always user. |
| Box.Item.modified_by.name | String | The display name of the user who modified the item. |
| Box.Item.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.Item.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.Item.owned_by.type | String | Value is always user. |
| Box.Item.owned_by.name | String | The display name of the user who owns the item. |
| Box.Item.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.Item.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.Item.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.Item.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.Item.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.Item.shared_link.access | String | The access level for the shared link. |
| Box.Item.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.Item.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.Item.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.Item.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.Item.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.Item.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.Item.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.Item.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.Item.parent.id | Number | The ID of the parent for the item found |
| Box.Item.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.Item.parent.type | String | The type for the parent of the item found. |
| Box.Item.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.Item.parent.name | String | The name of the parent of the item. |
| Box.Item.item_status | String | The status of the parent of the item. |
Command Example
!box-trashed-item-restore item_id="751526132294" type="file" as_user="14342567114"
Context Example
{
"Box": {
"Item": {
"content_created_at": "2020-12-09T08:49:16-08:00",
"content_modified_at": "2020-12-09T08:49:16-08:00",
"created_at": "2020-12-09T09:16:32-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "12",
"file_version": {
"id": "801011020694",
"sha1": "aa58d9692d58f5d9316d7cf1950d19a0b01bc204",
"type": "file_version"
},
"id": "751526132294",
"item_status": "active",
"modified_at": "2020-12-09T09:16:32-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "list.json",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "12",
"sha1": "aa58d9692d58f5d9316d7cf1950d19a0b01bc204",
"shared_link": null,
"size": 1135,
"trashed_at": null,
"type": "file"
}
}
}
Human Readable Output
Item with the ID 751526132294 was restored.
box-trashed-item-delete-permanently
Permanently deletes a file or folder that is in the trash. This action cannot be undone.
Base Command
box-trashed-item-delete-permanently
Input
| Argument Name | Description | Required |
|---|---|---|
| item_id | The unique identifier that represents the file or folder. | Required |
| type | The type of the item to delete. Possible values are: file, folder. | Required |
| as_user | The user who is performing the action. | Optional |
Context Output
There is no context output for this command.
Command Example
#### Human Readable Output
### box-get-current-user
***
Retrieves information about the user who is currently authenticated.
#### Base Command
`box-get-current-user`
#### Input
| **Argument Name** | **Description** | **Required** |
| --- | --- | --- |
| as_user | The ID of the user making the request. | Optional |
#### Context Output
| **Path** | **Type** | **Description** |
| --- | --- | --- |
| Box.User.id | Number | The unique identifier for this user. |
| Box.User.type | String | Value is always user. |
| Box.User.name | String | The display name of this user. |
| Box.User.login | String | The primary email address of this user. |
| Box.User.created_at | Date | When the user object was created. |
| Box.User.modified_at | Date | When the user object was last modified. |
| Box.User.language | String | The language of the user, formatted in a modified version of the ISO 639-1 format. |
| Box.User.timezone | String | The users timezone. |
| Box.User.space_amount | Number | The user's total available space amount in bytes. |
| Box.User.space_used | Number | The amount of space in use by the user. |
| Box.User.max_upload_size | Number | The maximum individual file size in bytes the user can have. |
| Box.User.status | String | The user's account status. |
| Box.User.job_title | String | The user's job title. |
| Box.User.phone | Number | The user's phone number. |
| Box.User.address | String | The user's address. |
| Box.User.avatar_url | String | URL of the user's avatar image |
| Box.User.notification_email.email | String | The email address to send the notifications to. |
| Box.User.notification_email.is_confirmed | Boolean | Specifies if this email address has been confirmed. |
#### Command Example
```!box-get-current-user as_user="14342567114"```
#### Context Example
```json
{
"Box": {
"User": {
"address": "",
"avatar_url": "https://app.box.com/api/avatar/large/14342567114",
"created_at": "2020-11-11T04:34:53-08:00",
"id": "14342567114",
"job_title": "",
"language": "en",
"login": "test@test.com",
"max_upload_size": 2147483648,
"modified_at": "2020-12-15T03:58:34-08:00",
"name": "Jane Doe",
"notification_email": [],
"phone": "4808675309",
"space_amount": 10737418240,
"space_used": 212311360,
"status": "active",
"timezone": "America/Los_Angeles",
"type": "user"
}
}
}
Human Readable Output
The current user is test@test.com
Avatar Url Created At Id Language Login Max Upload Size Modified At Name Phone Space Amount Space Used Status Timezone Type https://app.box.com/api/avatar/large/14342567114 2020-11-11T04:34:53-08:00 14342567114 en test@test.com 2147483648 2020-12-15T03:58:34-08:00 Jane Doe 4808675309 10737418240 212311360 active America/Los_Angeles user
box-update-user
Updates a managed user in an enterprise. This endpoint is only available to users and applications with the right admin permissions.
Base Command
box-update-user
Input
| Argument Name | Description | Required |
|---|---|---|
| role | The user’s enterprise role. Possible values are: coadmin, user. | Optional |
| address | The user’s address. | Optional |
| job_title | The user’s job title. | Optional |
| language | The language of the user, formatted in a modified version of the ISO 639-1 format. | Optional |
| login | The email address the user uses to log in. | Optional |
| name | The name of the user. | Optional |
| phone | The user’s phone number. | Optional |
| space_amount | The user’s total available space in bytes. Set this to -1 to indicate unlimited storage. | Optional |
| status | The user’s account status. Possible values are: active, inactive, cannot_delete_edit, cannot_delete_edit_upload. | Optional |
| timezone | The user’s timezone. | Optional |
| is_sync_enabled | Whether the user can use Box Sync. Possible values are: true, false. | Optional |
| is_exempt_from_device_limits | Whether to exempt the user from enterprise device limits. Possible values are: true, false. | Optional |
| is_external_collab_restricted | Whether the user is allowed to collaborate with users outside their enterprise. Possible values are: true, false. | Optional |
| is_exempt_from_login_verification | Whether the user must use two-factor authentication. Possible values are: true, false. | Optional |
| can_see_managed_users | Whether the user can see other enterprise users in their contact list. Possible values are: true, false. | Optional |
| tracking_codes | A tracking code that allows an admin to generate reports from the admin console and assign an attribute to a specific group of users. The expected format is key1:value1,key2:value2. Multiple key value pairs may be used when using the , separator. |
Optional |
| user_id | The ID of the user. | Required |
| as_user | The ID of the user who is making the request. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.User.id | Number | The unique identifier for this user. |
| Box.User.type | String | Value is always user. |
| Box.User.name | String | The display name of this user. |
| Box.User.login | String | The primary email address of this user. |
| Box.User.created_at | Date | When the user object was created. |
| Box.User.modified_at | Date | When the user object was last modified. |
| Box.User.language | String | The language of the user, formatted in a modified version of the ISO 639-1 format. |
| Box.User.timezone | String | The user’s timezone. |
| Box.User.space_amount | Number | The user’s total available space amount in bytes. |
| Box.User.space_used | Number | The amount of space in use by the user. |
| Box.User.max_upload_size | Number | The maximum individual file size in bytes the user can have. |
| Box.User.status | String | The user’s account status. |
| Box.User.job_title | String | The user’s job title. |
| Box.User.phone | Number | The user’s phone number. |
| Box.User.address | String | The user’s address. |
| Box.User.avatar_url | String | URL of the user’s avatar image |
| Box.User.notification_email.email | String | The email address to send the notifications to. |
| Box.User.notification_email.is_confirmed | Boolean | Specifies if this email address has been confirmed. |
Command Example
!box-update-user phone="4808675309" is_sync_enabled="true" is_exempt_from_device_limits="true" is_external_collab_restricted="false" is_exempt_from_login_verification="false" can_see_managed_users="true" user_id="14342567114" as_user="14342567114"
Context Example
{
"Box": {
"User": {
"address": "",
"avatar_url": "https://app.box.com/api/avatar/large/14342567114",
"created_at": "2020-11-11T04:34:53-08:00",
"id": "14342567114",
"job_title": "",
"language": "en",
"login": "test@test.com",
"max_upload_size": 2147483648,
"modified_at": "2020-12-15T03:59:04-08:00",
"name": "Jane Doe",
"notification_email": [],
"phone": "4808675309",
"space_amount": 10737418240,
"space_used": 212312495,
"status": "active",
"timezone": "America/Los_Angeles",
"type": "user"
}
}
}
Human Readable Output
The user test@test.com has been updated
Avatar Url Created At Id Language Login Max Upload Size Modified At Name Phone Space Amount Space Used Status Timezone Type https://app.box.com/api/avatar/large/14342567114 2020-11-11T04:34:53-08:00 14342567114 en test@test.com 2147483648 2020-12-15T03:59:04-08:00 Jane Doe 4808675309 10737418240 212312495 active America/Los_Angeles user
box-create-user
Creates a new managed user in an enterprise. This endpoint is only available to users and applications with the right admin permissions.
Base Command
box-create-user
Input
| Argument Name | Description | Required |
|---|---|---|
| as_user | The user who is making the request. | Optional |
| login | The email address the user uses to log in. | Optional |
| name | The name of the user. | Required |
| role | The user’s enterprise role. Possible values are: coadmin, user. | Optional |
| language | The language of the user, formatted in a modified version of the ISO 639-1 format. | Optional |
| is_sync_enabled | Whether the user can use Box Sync. Possible values are: true, false. | Optional |
| job_title | The user’s job title. | Optional |
| phone | The user’s phone number. | Optional |
| address | The user’s address. | Optional |
| space_amount | The user’s total available space in bytes. Set this to -1 to indicate unlimited storage. | Optional |
| tracking_codes | A tracking code that allows an admin to generate reports from the admin console and assign an attribute to a specific group of users. The expected format is key1:value1,key2:value2. Multiple key value pairs may be used when using the , separator. |
Optional |
| can_see_managed_users | Whether the user can see other enterprise users in their contact list. Possible values are: true, false. | Optional |
| timezone | The user’s timezone. | Optional |
| is_exempt_from_device_limits | Whether to exempt the user from enterprise device limits. Possible values are: true, false. | Optional |
| is_exempt_from_login_verification | Whether the user must use two-factor authentication. Possible values are: true, false. | Optional |
| is_external_collab_restricted | Whether the user is allowed to collaborate with users outside their enterprise. Possible values are: true, false. | Optional |
| is_platform_access_only | Specifies that the user is an app user. Possible values are: true, false. | Optional |
| status | The user’s account status. Possible values are: active, inactive, cannot_delete_edit, cannot_delete_edit_upload. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.User.id | Number | The unique identifier for this user. |
| Box.User.type | String | Value is always user. |
| Box.User.name | String | The display name of this user. |
| Box.User.login | String | The primary email address of this user. |
| Box.User.created_at | Date | When the user object was created. |
| Box.User.modified_at | Date | When the user object was last modified. |
| Box.User.language | String | The language of the user, formatted in a modified version of the ISO 639-1 format. |
| Box.User.timezone | String | The user’s timezone. |
| Box.User.space_amount | Number | The user’s total available space amount in bytes. |
| Box.User.space_used | Number | The amount of space in use by the user. |
| Box.User.max_upload_size | Number | The maximum individual file size in bytes the user can have. |
| Box.User.status | String | The user’s account status. |
| Box.User.job_title | String | The user’s job title. |
| Box.User.phone | Number | The user’s phone number. |
| Box.User.address | String | The user’s address. |
| Box.User.avatar_url | String | URL of the user’s avatar image |
| Box.User.notification_email.email | String | The email address to send the notifications to. |
| Box.User.notification_email.is_confirmed | Boolean | Specifies if this email address has been confirmed. |
Command Example
!box-create-user name="some_name_test" is_sync_enabled="false" phone="000000000" can_see_managed_users="false" is_exempt_from_device_limits="true" is_exempt_from_login_verification="false" is_external_collab_restricted="false" is_platform_access_only="true"
Context Example
{
"Box": {
"User": {
"address": "",
"avatar_url": "https://app.box.com/api/avatar/large/14658591950",
"created_at": "2020-12-15T03:58:28-08:00",
"id": "14658591950",
"job_title": "",
"language": "en",
"login": "AppUser_1403892_rBpFRjYb94@boxdevedition.com",
"max_upload_size": 2147483648,
"modified_at": "2020-12-15T03:58:28-08:00",
"name": "some_name_test",
"notification_email": [],
"phone": "000000000",
"space_amount": 10737418240,
"space_used": 0,
"status": "active",
"timezone": "America/Los_Angeles",
"type": "user"
}
}
}
Human Readable Output
The user AppUser_1403892_rBpFRjYb94@boxdevedition.com has been created
Avatar Url Created At Id Language Login Max Upload Size Modified At Name Phone Space Amount Space Used Status Timezone Type https://app.box.com/api/avatar/large/14658591950 2020-12-15T03:58:28-08:00 14658591950 en AppUser_1403892_rBpFRjYb94@boxdevedition.com 2147483648 2020-12-15T03:58:28-08:00 some_name_test 000000000 10737418240 0 active America/Los_Angeles user
box-delete-user
Deletes a user. By default this will fail if the user still owns any content. Move their owned content first before proceeding, or use the force field to delete the user and their files.
Base Command
box-delete-user
Input
| Argument Name | Description | Required |
|---|---|---|
| user_id | The ID of the user. | Required |
| as_user | The user ID of the account making the request. | Optional |
| force | Whether the user should be deleted even if this user still own files. Possible values are: true, false. | Optional |
Context Output
There is no context output for this command.
Command Example
!box-delete-user user_id="14639008448"
Context Example
{}
Human Readable Output
The user 14639008448 was successfully deleted.
box-list-user-events
Returns up to a year of past events for a given user.
Base Command
box-list-user-events
Input
| Argument Name | Description | Required |
|---|---|---|
| as_user | The user who is performing the action. | Optional |
| stream_type | The type of stream to retrieve. Possible values are: all, changes, sync. | Required |
| limit | The maximum number of events to return. Default is “100”. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Events.type | String | The type of the event. |
| Box.Events.event_id | String | The ID of the event object. You can use this to detect duplicate events. |
| Box.Events.created_by.type | String | Value is always user. |
| Box.Events.created_by.id | Date | The unique identifier for this user. |
| Box.Events.created_by.name | String | The display name of this user. |
| Box.Events.created_by.login | String | The primary email address of this user. |
| Box.Events.created_at | Date | Time which the event was created. |
| Box.Events.recorded_at | Date | Time which the event was recorded. |
| Box.Events.event_type | String | The event type that triggered this event. |
| Box.Events.session_id | String | The session of the user who performed the action. Not all events will populate this attribute. |
Command Example
!box-list-user-events stream_type="all" limit="1"
Context Example
{
"Box": {
"Events": [
{
"created_at": "2020-11-25T04:12:23-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "821c82f3cf438bf0d206aa80aac526ea1700a46b",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T04:12:24-08:00",
"session_id": "stw7zogl1ohiczrp",
"source": {
"content_created_at": "2020-11-25T04:12:23-08:00",
"content_modified_at": "2020-11-25T04:12:23-08:00",
"created_at": "2020-11-25T04:12:23-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794713426050",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745851995250",
"item_status": "active",
"modified_at": "2020-11-25T04:12:23-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T04:24:37-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "0fcb31e458fd14483cf760e1895ee69980eaff62",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T04:24:37-08:00",
"session_id": "ifhnscgl1ou83ihz",
"source": {
"content_created_at": "2020-11-25T04:24:36-08:00",
"content_modified_at": "2020-11-25T04:24:36-08:00",
"created_at": "2020-11-25T04:24:36-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794716642653",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745854929853",
"item_status": "active",
"modified_at": "2020-11-25T04:24:36-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image1.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T04:34:17-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "3d89043e5c46897ac77702f553622204666120a4",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T04:34:18-08:00",
"session_id": "rn9j4egl1p4a7lts",
"source": {
"content_created_at": "2020-11-25T04:34:16-08:00",
"content_modified_at": "2020-11-25T04:34:16-08:00",
"created_at": "2020-11-25T04:34:16-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794719141622",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745857164822",
"item_status": "active",
"modified_at": "2020-11-25T04:34:16-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image2.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T04:36:04-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "40b93bf6eb12fb167a51cdf03e3c3444a6a265b0",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T04:36:05-08:00",
"session_id": "amo218gl1p65hgdk",
"source": {
"content_created_at": "2020-11-25T04:36:04-08:00",
"content_modified_at": "2020-11-25T04:36:04-08:00",
"created_at": "2020-11-25T04:36:04-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794721102684",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745859107884",
"item_status": "active",
"modified_at": "2020-11-25T04:36:04-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image3.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T05:18:44-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "6a9dee69e8f0fdc81e75fa63b1e9c35b80200481",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T05:18:45-08:00",
"session_id": "e2axvxgl1qejl0ar",
"source": {
"content_created_at": "2020-11-25T05:18:44-08:00",
"content_modified_at": "2020-11-25T05:18:44-08:00",
"created_at": "2020-11-25T05:18:44-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794733314512",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745870218112",
"item_status": "active",
"modified_at": "2020-11-25T05:18:44-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image4.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T05:20:56-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "ba2a5d3dca51a7edefbdf06543295a74bc773cb4",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T05:20:56-08:00",
"session_id": "khuqgfgl1qgtmk0w",
"source": {
"content_created_at": "2020-11-25T05:20:55-08:00",
"content_modified_at": "2020-11-25T05:20:55-08:00",
"created_at": "2020-11-25T05:20:56-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794731944502",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745868717302",
"item_status": "active",
"modified_at": "2020-11-25T05:20:56-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image5.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T05:25:44-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "a56e6d1020c8cfb7ce22a990e6da5192001b1c1e",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T05:25:45-08:00",
"session_id": "yoajnqgl1qltqhfl",
"source": {
"content_created_at": "2020-11-25T05:25:44-08:00",
"content_modified_at": "2020-11-25T05:25:44-08:00",
"created_at": "2020-11-25T05:25:44-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794736891054",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"type": "file_version"
},
"id": "745873525854",
"item_status": "active",
"modified_at": "2020-11-25T05:25:44-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image6_please_work.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "1ff8be1766d9e16b0b651f89001e8e7375c9e71f",
"shared_link": null,
"size": 26891788,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T06:47:49-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "e9bbd0c85123ebbb1074664c4176f75e6da8cd7f",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T06:47:50-08:00",
"session_id": "qhq59lgl1sz8a1k3",
"source": {
"content_created_at": "2020-11-25T06:47:49-08:00",
"content_modified_at": "2020-11-25T06:47:49-08:00",
"created_at": "2020-11-25T06:47:49-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794763039912",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file_version"
},
"id": "745897019112",
"item_status": "active",
"modified_at": "2020-11-25T06:47:49-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image7_please_work.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"shared_link": null,
"size": 3653705,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T06:48:49-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "be9d499190f23542227cad001c02d8c2bb22c65c",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T06:49:05-08:00",
"session_id": "w1pn5lgl1t09vsfa",
"source": {
"content_created_at": "2020-11-25T06:48:49-08:00",
"content_modified_at": "2020-11-25T06:48:49-08:00",
"created_at": "2020-11-25T06:48:49-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794764186997",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file_version"
},
"id": "745898101397",
"item_status": "active",
"modified_at": "2020-11-25T06:48:49-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image8_please_work.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"shared_link": null,
"size": 3653705,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
},
{
"created_at": "2020-11-25T06:50:31-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "4ce8a9d707a286ea1c62eb2fcccc399bccc68278",
"event_type": "ITEM_UPLOAD",
"recorded_at": "2020-11-25T06:50:32-08:00",
"session_id": "zlecagl1t21rmdp",
"source": {
"content_created_at": "2020-11-25T06:50:31-08:00",
"content_modified_at": "2020-11-25T06:50:31-08:00",
"created_at": "2020-11-25T06:50:31-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"description": "",
"etag": "0",
"file_version": {
"id": "794764999514",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"type": "file_version"
},
"id": "745898898314",
"item_status": "active",
"modified_at": "2020-11-25T06:50:31-08:00",
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "image9_please_work.gif",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
},
"path_collection": {
"entries": [
{
"etag": null,
"id": "0",
"name": "All Files",
"sequence_id": null,
"type": "folder"
}
],
"total_count": 1
},
"purged_at": null,
"sequence_id": "0",
"sha1": "bd992f78f1f50b4b424b0633870aca5eed3bedce",
"shared_link": null,
"size": 3653705,
"synced": true,
"trashed_at": null,
"type": "file"
},
"type": "event"
}
]
}
}
Human Readable Output
Events found for the user: 14342567114
Created At Created By Event Id Event Type Recorded At Session Id Source Type 2020-11-25T04:12:23-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com821c82f3cf438bf0d206aa80aac526ea1700a46b ITEM_UPLOAD 2020-11-25T04:12:24-08:00 stw7zogl1ohiczrp type: file
id: 745851995250
file_version: {“type”: “file_version”, “id”: “794713426050”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T04:12:23-08:00
modified_at: 2020-11-25T04:12:23-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T04:12:23-08:00
content_modified_at: 2020-11-25T04:12:23-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T04:24:37-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com0fcb31e458fd14483cf760e1895ee69980eaff62 ITEM_UPLOAD 2020-11-25T04:24:37-08:00 ifhnscgl1ou83ihz type: file
id: 745854929853
file_version: {“type”: “file_version”, “id”: “794716642653”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image1.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T04:24:36-08:00
modified_at: 2020-11-25T04:24:36-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T04:24:36-08:00
content_modified_at: 2020-11-25T04:24:36-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T04:34:17-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com3d89043e5c46897ac77702f553622204666120a4 ITEM_UPLOAD 2020-11-25T04:34:18-08:00 rn9j4egl1p4a7lts type: file
id: 745857164822
file_version: {“type”: “file_version”, “id”: “794719141622”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image2.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T04:34:16-08:00
modified_at: 2020-11-25T04:34:16-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T04:34:16-08:00
content_modified_at: 2020-11-25T04:34:16-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T04:36:04-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com40b93bf6eb12fb167a51cdf03e3c3444a6a265b0 ITEM_UPLOAD 2020-11-25T04:36:05-08:00 amo218gl1p65hgdk type: file
id: 745859107884
file_version: {“type”: “file_version”, “id”: “794721102684”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image3.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T04:36:04-08:00
modified_at: 2020-11-25T04:36:04-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T04:36:04-08:00
content_modified_at: 2020-11-25T04:36:04-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T05:18:44-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com6a9dee69e8f0fdc81e75fa63b1e9c35b80200481 ITEM_UPLOAD 2020-11-25T05:18:45-08:00 e2axvxgl1qejl0ar type: file
id: 745870218112
file_version: {“type”: “file_version”, “id”: “794733314512”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image4.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T05:18:44-08:00
modified_at: 2020-11-25T05:18:44-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T05:18:44-08:00
content_modified_at: 2020-11-25T05:18:44-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T05:20:56-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comba2a5d3dca51a7edefbdf06543295a74bc773cb4 ITEM_UPLOAD 2020-11-25T05:20:56-08:00 khuqgfgl1qgtmk0w type: file
id: 745868717302
file_version: {“type”: “file_version”, “id”: “794731944502”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image5.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T05:20:56-08:00
modified_at: 2020-11-25T05:20:56-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T05:20:55-08:00
content_modified_at: 2020-11-25T05:20:55-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T05:25:44-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.coma56e6d1020c8cfb7ce22a990e6da5192001b1c1e ITEM_UPLOAD 2020-11-25T05:25:45-08:00 yoajnqgl1qltqhfl type: file
id: 745873525854
file_version: {“type”: “file_version”, “id”: “794736891054”, “sha1”: “1ff8be1766d9e16b0b651f89001e8e7375c9e71f”}
sequence_id: 0
etag: 0
sha1: 1ff8be1766d9e16b0b651f89001e8e7375c9e71f
name: image6_please_work.gif
description:
size: 26891788
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T05:25:44-08:00
modified_at: 2020-11-25T05:25:44-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T05:25:44-08:00
content_modified_at: 2020-11-25T05:25:44-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T06:47:49-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.come9bbd0c85123ebbb1074664c4176f75e6da8cd7f ITEM_UPLOAD 2020-11-25T06:47:50-08:00 qhq59lgl1sz8a1k3 type: file
id: 745897019112
file_version: {“type”: “file_version”, “id”: “794763039912”, “sha1”: “bd992f78f1f50b4b424b0633870aca5eed3bedce”}
sequence_id: 0
etag: 0
sha1: bd992f78f1f50b4b424b0633870aca5eed3bedce
name: image7_please_work.gif
description:
size: 3653705
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T06:47:49-08:00
modified_at: 2020-11-25T06:47:49-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T06:47:49-08:00
content_modified_at: 2020-11-25T06:47:49-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T06:48:49-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.combe9d499190f23542227cad001c02d8c2bb22c65c ITEM_UPLOAD 2020-11-25T06:49:05-08:00 w1pn5lgl1t09vsfa type: file
id: 745898101397
file_version: {“type”: “file_version”, “id”: “794764186997”, “sha1”: “bd992f78f1f50b4b424b0633870aca5eed3bedce”}
sequence_id: 0
etag: 0
sha1: bd992f78f1f50b4b424b0633870aca5eed3bedce
name: image8_please_work.gif
description:
size: 3653705
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T06:48:49-08:00
modified_at: 2020-11-25T06:48:49-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T06:48:49-08:00
content_modified_at: 2020-11-25T06:48:49-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent 2020-11-25T06:50:31-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com4ce8a9d707a286ea1c62eb2fcccc399bccc68278 ITEM_UPLOAD 2020-11-25T06:50:32-08:00 zlecagl1t21rmdp type: file
id: 745898898314
file_version: {“type”: “file_version”, “id”: “794764999514”, “sha1”: “bd992f78f1f50b4b424b0633870aca5eed3bedce”}
sequence_id: 0
etag: 0
sha1: bd992f78f1f50b4b424b0633870aca5eed3bedce
name: image9_please_work.gif
description:
size: 3653705
path_collection: {“total_count”: 1, “entries”: [{“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}]}
created_at: 2020-11-25T06:50:31-08:00
modified_at: 2020-11-25T06:50:31-08:00
trashed_at: null
purged_at: null
content_created_at: 2020-11-25T06:50:31-08:00
content_modified_at: 2020-11-25T06:50:31-08:00
created_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
modified_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}
shared_link: null
parent: {“type”: “folder”, “id”: “0”, “sequence_id”: null, “etag”: null, “name”: “All Files”}
item_status: active
synced: trueevent
box-list-enterprise-events
Returns up to a year of past events for the entire enterprise.
Base Command
box-list-enterprise-events
Input
| Argument Name | Description | Required |
|---|---|---|
| as_user | The user who is performing the action. | Optional |
| created_after | The lower bound date and time to return events for. | Optional |
| limit | The maximum number of events to return. Default is “100”. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Events.source.item_type | String | The type of the item that the event represents. |
| Box.Events.source.item_id | Date | The unique identifier that represents the item. |
| Box.Events.source.item_name | String | The name of the item. |
| Box.Events.source.parent.type | String | Value is always folder. |
| Box.Events.source.parent.name | String | The name of the folder. |
| Box.Events.source.parent.id | String | The unique identifier that represents a folder. |
| Box.Events.source.owned_by.type | String | Value is always user. |
| Box.Events.source.owned_by.id | Date | The unique identifier for this user. |
| Box.Events.source.owned_by.name | String | The display name of this user. |
| Box.Events.source.owned_by.login | String | The primary email address of this user. |
| Box.Events.created_by.type | String | Value is always user. |
| Box.Events.created_by.id | Date | The unique identifier for this user. |
| Box.Events.created_by.name | String | The display name of this user. |
| Box.Events.created_by.login | String | The primary email address of this user. |
| Box.Events.created_at | Date | Time which the event was created. |
| Box.Events.event_id | String | The ID of the event object. You can use this to detect duplicate events. |
| Box.Events.event_type | String | The event type that triggered this event. |
| Box.Events.ip_address | String | IP address of the user who triggered the event. |
| Box.Events.type | String | Always event. |
Command Example
!box-list-enterprise-events created_after="1 day" limit="1"
Context Example
{
"Box": {
"Events": [
{
"action_by": null,
"additional_details": {
"size": 18860439,
"version_id": "803108695891"
},
"created_at": "2020-12-15T00:44:58-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "451677f7-9c7c-497d-a272-69903c1f6c29",
"event_type": "RENAME",
"ip_address": "37.142.10.140",
"session_id": null,
"source": {
"item_id": "753421883491",
"item_name": "vandijk3.gif",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"size": 18860439,
"version_id": "803108695891"
},
"created_at": "2020-12-15T00:50:37-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "457eebd9-5b26-4333-a3f9-44f040de7220",
"event_type": "RENAME",
"ip_address": "37.142.10.140",
"session_id": null,
"source": {
"item_id": "753421883491",
"item_name": "vandijk4.gif",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"size": 18860439,
"version_id": "803108695891"
},
"created_at": "2020-12-15T00:53:33-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "e6b91f7a-3eb3-4968-8aef-7ea90ed46f21",
"event_type": "RENAME",
"ip_address": "37.142.10.140",
"session_id": null,
"source": {
"item_id": "753421883491",
"item_name": "vandijk5.gif",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"shared_link_id": "2hvls15bpbmrjuo4vks6znrvye6gm6g1",
"size": 92934,
"version_id": "790694844770"
},
"created_at": "2020-12-15T03:07:44-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "16b5dbef-3175-41c1-8486-dc6d279f4c63",
"event_type": "ITEM_SHARED_UPDATE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "742246263170",
"item_name": "download.jpeg",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "125959916474",
"name": "My Box Notes",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"size": 1135,
"version_id": "801011020694"
},
"created_at": "2020-12-15T03:07:54-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "3a30d7f7-ce0d-4a4b-a9f8-c8cbccead2dc",
"event_type": "DELETE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "751526132294",
"item_name": "list.json",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"size": 92934,
"version_id": "790694844770"
},
"created_at": "2020-12-15T03:08:15-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "a71b25af-df2c-4693-8026-e7b1ecd30af9",
"event_type": "UNSHARE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "742246263170",
"item_name": "download.jpeg",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "125959916474",
"name": "My Box Notes",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"shared_link_id": "tkaz5qjy0hmkr5pvnvhoszcjbtx74j3y",
"size": 92934,
"version_id": "790694844770"
},
"created_at": "2020-12-15T03:11:22-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "dba908b8-3813-4117-bbec-763cdd320748",
"event_type": "SHARE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "742246263170",
"item_name": "download.jpeg",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "125959916474",
"name": "My Box Notes",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"size": 92934,
"version_id": "790694844770"
},
"created_at": "2020-12-15T03:11:50-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "fe379c6f-a85c-452a-8e7a-2c6e24397a75",
"event_type": "UNSHARE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "742246263170",
"item_name": "download.jpeg",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "125959916474",
"name": "My Box Notes",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING"
},
"created_at": "2020-12-15T03:11:52-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "b6b320af-5a8a-4352-9d78-44620ccbc2f7",
"event_type": "UNSHARE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "125959916474",
"item_name": "My Box Notes",
"item_type": "folder",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
},
{
"action_by": null,
"additional_details": {
"service_id": "1403892",
"service_name": "XSOAR_TESTING",
"size": 1135,
"version_id": "801011020694"
},
"created_at": "2020-12-15T03:11:59-08:00",
"created_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"event_id": "cdc29617-5e30-477f-8a56-0497457c61fb",
"event_type": "UNDELETE",
"ip_address": "176.34.214.130",
"session_id": null,
"source": {
"item_id": "751526132294",
"item_name": "list.json",
"item_type": "file",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": {
"id": "0",
"name": "All Files",
"type": "folder"
}
},
"type": "event"
}
]
}
}
Human Readable Output
Enterprise Events found
Additional Details Created At Created By Event Id Event Type Ip Address Source Type size: 18860439
version_id: 8031086958912020-12-15T00:44:58-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com451677f7-9c7c-497d-a272-69903c1f6c29 RENAME 37.142.10.140 item_type: file
item_id: 753421883491
item_name: vandijk3.gif
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 18860439
version_id: 8031086958912020-12-15T00:50:37-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com457eebd9-5b26-4333-a3f9-44f040de7220 RENAME 37.142.10.140 item_type: file
item_id: 753421883491
item_name: vandijk4.gif
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 18860439
version_id: 8031086958912020-12-15T00:53:33-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.come6b91f7a-3eb3-4968-8aef-7ea90ed46f21 RENAME 37.142.10.140 item_type: file
item_id: 753421883491
item_name: vandijk5.gif
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event shared_link_id: 2hvls15bpbmrjuo4vks6znrvye6gm6g1
size: 92934
version_id: 790694844770
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:07:44-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com16b5dbef-3175-41c1-8486-dc6d279f4c63 ITEM_SHARED_UPDATE 176.34.214.130 item_type: file
item_id: 742246263170
item_name: download.jpeg
parent: {“type”: “folder”, “name”: “My Box Notes”, “id”: “125959916474”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 1135
version_id: 801011020694
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:07:54-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.com3a30d7f7-ce0d-4a4b-a9f8-c8cbccead2dc DELETE 176.34.214.130 item_type: file
item_id: 751526132294
item_name: list.json
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 92934
version_id: 790694844770
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:08:15-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.coma71b25af-df2c-4693-8026-e7b1ecd30af9 UNSHARE 176.34.214.130 item_type: file
item_id: 742246263170
item_name: download.jpeg
parent: {“type”: “folder”, “name”: “My Box Notes”, “id”: “125959916474”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event shared_link_id: tkaz5qjy0hmkr5pvnvhoszcjbtx74j3y
size: 92934
version_id: 790694844770
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:11:22-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comdba908b8-3813-4117-bbec-763cdd320748 SHARE 176.34.214.130 item_type: file
item_id: 742246263170
item_name: download.jpeg
parent: {“type”: “folder”, “name”: “My Box Notes”, “id”: “125959916474”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 92934
version_id: 790694844770
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:11:50-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comfe379c6f-a85c-452a-8e7a-2c6e24397a75 UNSHARE 176.34.214.130 item_type: file
item_id: 742246263170
item_name: download.jpeg
parent: {“type”: “folder”, “name”: “My Box Notes”, “id”: “125959916474”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:11:52-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comb6b320af-5a8a-4352-9d78-44620ccbc2f7 UNSHARE 176.34.214.130 item_type: folder
item_id: 125959916474
item_name: My Box Notes
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event size: 1135
version_id: 801011020694
service_id: 1403892
service_name: XSOAR_TESTING2020-12-15T03:11:59-08:00 type: user
id: 14342567114
name: Jane Doe
login: test@test.comcdc29617-5e30-477f-8a56-0497457c61fb UNDELETE 176.34.214.130 item_type: file
item_id: 751526132294
item_name: list.json
parent: {“type”: “folder”, “name”: “All Files”, “id”: “0”}
owned_by: {“type”: “user”, “id”: “14342567114”, “name”: “Jane Doe”, “login”: “test@test.com”}event
box-download-file
Returns the contents of a file in binary format.
Base Command
box-download-file
Input
| Argument Name | Description | Required |
|---|---|---|
| file_id | The ID of the file. | Required |
| as_user | The user ID of the account making the request. | Optional |
Context Output
There is no context output for this command.
Command Example
!box-download-file file_id="745898898314" as_user="14342567114"
Context Example
{}
Human Readable Output
Uploaded file: TestFile.gif
box-move-folder
Moves all of the items (files, folders and workflows) owned by a user into another user’s account. Only the root folder 0 will be transferred.
Folders can only be moved across users by users with administrative permissions.
This command is performed synchronously which might lead to a slow response when the source user has a large number of items in all of its folders.
Base Command
box-move-folder
Input
| Argument Name | Description | Required |
|---|---|---|
| to_user_id | The ID of the user who will receive the folders. | Required |
| from_user_id | The ID of the user who currently owns the folder. | Required |
| notify | Determines if users should receive email notification for the action performed. | Optional |
Context Output
| Path | Type | Description |
|---|---|---|
| Box.Folder.id | Number | The ID of the folder created. |
| Box.Folder.etag | Number | The entry tag for the folder created. |
| Box.Folder.type | String | The type of folder. |
| Box.Folder.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the folder. |
| Box.Folder.name | String | The name of the folder. |
| Box.Folder.sha1 | String | The SHA1 hash of the folder. |
| Box.Folder.file_version.id | Number | The unique identifier that represents a file version. |
| Box.Folder.file_version.type | String | Value is always file_version. |
| Box.Folder.file_version.sha1 | String | The SHA1 hash of this version of the file. |
| Box.Folder.description | String | The description of the item. |
| Box.Folder.size | Number | The folder size in bytes. |
| Box.Folder.path_collection.total_count | Number | The number of folders in the list. |
| Box.Folder.path_collection.entries.id | Number | The ID of the item found. |
| Box.Folder.path_collection.entries.etag | Number | The entry tag for the item found. |
| Box.Folder.path_collection.entries.type | String | The type of the item found. |
| Box.Folder.path_collection.entries.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the item. |
| Box.Folder.path_collection.entries.name | String | The name of the item. |
| Box.Folder.created_at | Date | The date and time when the item was created on Box. |
| Box.Folder.modified_at | Date | The date and time when the item was last updated on Box. |
| Box.Folder.trashed_at | Date | The time at which the item was put in the trash. |
| Box.Folder.purged_at | Date | The time at which the item is expected to be purged from the trash. |
| Box.Folder.content_created_at | Date | The date and time at which the item was originally created, which might be before it was uploaded to Box. |
| Box.Folder.content_modified_at | Date | The date and time at which the item was last updated, which might be before it was uploaded to Box. |
| Box.Folder.created_by.id | Number | The unique identifier for the user who created the item. |
| Box.Folder.created_by.type | String | Value is always user. |
| Box.Folder.created_by.name | String | The display name of the user who created the item. |
| Box.Folder.created_by.login | String | The primary email address of the user who created the item. |
| Box.Folder.modified_by.id | Number | The unique identifier for the user who modified the item. |
| Box.Folder.modified_by.type | String | Value is always user. |
| Box.Folder.modified_by.name | String | The display name of the user who modified the item. |
| Box.Folder.modified_by.login | String | The primary email address of the user who modified the item. |
| Box.Folder.owned_by.id | Number | The unique identifier for the user who owns the item. |
| Box.Folder.owned_by.type | String | Value is always user. |
| Box.Folder.owned_by.name | String | The display name of the user who owns the item. |
| Box.Folder.owned_by.login | String | The primary email address of the user who owns the item. |
| Box.Folder.shared_link.url | String | The URL that can be used to access the item on Box. |
| Box.Folder.shared_link.download_url | String | The URL that can be used to download the item from Box. |
| Box.Folder.shared_link.vanity_url | String | The “Custom URL” that can also be used to preview the item on Box. |
| Box.Folder.shared_link.vanity_name | String | The custom name of a shared link, as used in the vanity_url field. |
| Box.Folder.shared_link.access | String | The access level for the shared link. |
| Box.Folder.shared_link.effective_access | String | The effective access level for the shared link. |
| Box.Folder.shared_link.effective_permission | String | The effective permissions for this shared link. |
| Box.Folder.shared_link.unshared_at | Date | The date and time when the link will be unshared. |
| Box.Folder.shared_link.is_password_enabled | Boolean | Defines if the shared link requires a password to access the item. |
| Box.Folder.shared_link.permissions.can_download | Boolean | Defines if the shared link allows for the item to be downloaded. |
| Box.Folder.shared_link.permissions.can_preview | Boolean | Defines if the shared link allows for the item to be previewed. |
| Box.Folder.shared_link.download_count | Number | The number of times the item has been downloaded. |
| Box.Folder.shared_link.preview_count | Number | The number of times the item has been previewed. |
| Box.Folder.parent.id | Number | The ID of the parent for the item found |
| Box.Folder.parent.etag | Number | The entry tag for the parent of the item found. |
| Box.Folder.parent.type | String | The type for the parent of the item found. |
| Box.Folder.parent.sequence_id | Number | The numeric identifier that represents the most recent user event that has been applied to the parent of the item. |
| Box.Folder.parent.name | String | The name of the parent of the item. |
| Box.Folder.item_status | String | The status of the parent of the item. |
Command Example
!box-move-folder to_user_id="123456" from_user_id="654321" notify="true"
Context Example
{
"Box": {
"Folder": {
"content_created_at": null,
"content_modified_at": null,
"created_at": null,
"created_by": {
"id": "",
"login": "",
"name": "",
"type": "user"
},
"description": "",
"etag": null,
"folder_upload_email": null,
"id": "0",
"item_status": "active",
"modified_at": null,
"modified_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"name": "All Files",
"owned_by": {
"id": "14342567114",
"login": "test@test.com",
"name": "Jane Doe",
"type": "user"
},
"parent": null,
"path_collection": {
"entries": [],
"total_count": 0
},
"purged_at": null,
"sequence_id": null,
"shared_link": null,
"size": 212311360,
"trashed_at": null,
"type": "folder"
}
}
}
Human Readable Output
Folder overview for transferred folder
Created By Id Item Status Modified By Name Owned By Path Collection Size Type type: user
id:
name:
login:0 active type: user
id: 14342567114
name: Jane Doe
login: test@test.comAll Files type: user
id: 14342567114
name: Jane Doe
login: test@test.comtotal_count: 0
entries:212311360 folder
Configuration parameters
url— Server URL (required)insecure— Trust any certificate (not secure)credentials_json— Credentials JSONcred_json—as_user— User ID for Fetching Incidentsevent_type— Types of Events to Ingest as Incidentsdefault_user— Default Usersearch_user_id— Auto-detect user IDs based on their email address.incidentType— Incident typeincidentFetchInterval— Incidents Fetch IntervalisFetch— Fetch incidentsfirst_fetch— First fetch timestamp (<number> <time unit>, e.g., 12 hours, 7 days)max_fetch— The maximum amount of incidents to fetch at once
Commands (27)
-
box-create-file-share-linkAdds a shared link to a file.
-
box-create-folder-share-linkAdds a shared link to a folder.
-
box-create-userCreates a new managed user in an enterprise. This endpoint is only available to users and applications with the correct admin permissions.
-
box-delete-userDeletes a user. By default this will fail if the user still owns any content. Move their owned content before proceeding, or use the force field to delete the user and their files.
-
box-download-fileReturns the contents of a file in binary format.
-
box-file-deleteDeletes a file, either permanently or by moving it to the trash.
-
box-find-file-folder-by-share-linkReturn the file represented by a shared link.
-
box-folder-createCreates a new empty folder within the specified parent folder.
-
box-get-current-userRetrieves information about the user who is currently authenticated.
-
box-get-folderRetrieves details for a folder, including the first 100 entries in the folder.
-
box-get-shared-link-by-fileGets the information for a shared link on a file.
-
box-get-shared-link-by-folderGets the information for a shared link on a folder.
-
box-list-enterprise-eventsReturns up to a year of past events for the entire enterprise.
-
box-list-folder-itemsRetrieves a page of items in a folder.
-
box-list-user-eventsReturns up to a year of past events for a given user.
-
box-list-usersReturns a list of all users for the Enterprise along with their user_id, public_name, and login.
-
box-move-folderMove all of the items (files, folders and workflows) owned by a user into another user's account.
-
box-remove-file-share-linkRemoves a shared link from a file.
-
box-remove-folder-share-linkRemoves a shared link from a folder.
-
box-search-contentSearches for files, folders, web links, and shared files across the users' content or across the entire enterprise.
-
box-trashed-item-delete-permanentlyPermanently deletes a file or folder that is in the trash. This action cannot be undone.
-
box-trashed-item-restoreRestores a file or folder that has been moved to the trash.
-
box-trashed-items-listRetrieves the files and folders that have been moved to the trash.
-
box-update-file-share-linkUpdates a shared link on a file.
-
box-update-folder-share-linkUpdates a shared link on a folder.
-
box-update-userUpdates a managed user in an enterprise. This endpoint is only available to users and applications with the right admin permissions.
-
box-upload-fileUploads a file to the given folder.
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * import json import urllib3 import dateparser import traceback import time import secrets import jwt import re from datetime import UTC from typing import Any, BinaryIO from requests.models import Response from hashlib import sha1 from cryptography import exceptions from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.serialization import load_pem_private_key # Disable insecure warnings urllib3.disable_warnings() """ CONSTANTS """ DATE_FORMAT = "%Y-%m-%dT%H:%M:%S%z" MAX_INCIDENTS_TO_FETCH = 50 """ CLIENT CLASS """ class QueryHandler: """ Class which handles the search query parameters for the box-search-content command. """ def __init__(self, args): self.content_types = [] self.type = args.get("type") self.ancestor_folder_ids = args.get("ancestor_folder_ids") self.item_name = args.get("item_name") self.item_description = args.get("item_description") self.comments = args.get("comments") self.tag = args.get("tag") self.created_range = format_time_range(args.get("created_range")) self.file_extensions = args.get("file_extensions") self.limit = args.get("limit") self.offset = args.get("offset") self.owner_user_ids = args.get("owner_uids") self.trash_content = args.get("trash_content") self.updated_at_range = format_time_range(args.get("updated_at_range")) self.query = args.get("query") self.args = args if self.item_name: self.content_types.append("name") self.query = self.item_name self.item_name = None if self.item_description: self.content_types.append("description") self.query = self.item_description self.item_description = None if self.tag: self.content_types.append("tag") self.query = self.tag self.tag = None if self.comments: self.content_types.append("comments") self.query = self.comments self.comments = None def prepare_params_object(self): """ Creates a dictionary of all available arguments. This method allows for args to be manipulated and formatted prior to use. :return: dict containing the formatted query parameters """ query_params_dict = vars(QueryHandler(self.args)) query_params_dict.pop("args") return remove_empty_elements(query_params_dict) class FileShareLink: """ Class which handles the File Share Link object for CRUD operations. """ def __init__(self, args): self.access = args.get("access") self.password = args.get("password") self.unshared_at = args.get("unshared_at") self.permissions = {"can_download": argToBoolean(args.get("can_download", "False"))} self.file_id = args.get("file_id") self.args = args def prepare_request_object(self): """ Creates a dictionary of all available arguments. This method allows for args to be manipulated and formatted prior to use. :return: dict containing the formatted FileShareLink arguments as required by the API. """ file_share_dict = vars(FileShareLink(self.args)) file_share_dict.pop("file_id") file_share_dict.pop("args") return remove_empty_elements(file_share_dict) class FolderShareLink: """ Class which handles the Folder Share Link object for CRUD operations. """ def __init__(self, args): self.access = args.get("access") self.password = args.get("password") self.unshared_at = args.get("unshared_at") self.permissions = {"can_download": argToBoolean(args.get("can_download", "False"))} self.folder_id = args.get("folder_id") self.args = args if self.folder_id == "0": raise DemistoException("The root folder is incapable of being shared. Please provide a valid folder id.") def prepare_request_object(self): """ Creates a dictionary of all available arguments. This method allows for args to be manipulated and formatted prior to use. :return: dict containing the formatted FolderShareLink arguments as required by the API. """ folder_share_dict = vars(FolderShareLink(self.args)) folder_share_dict.pop("folder_id") folder_share_dict.pop("args") return remove_empty_elements(folder_share_dict) class Event: """ Class which handles the Event objects for incident creation. """ def __init__(self, raw_input): # Created at time is stored in either or two locations, never both. demisto.debug(f"Event init: created_at={raw_input.get('created_at')}, source exists= {bool(raw_input.get('source'))}") created_at = raw_input.get("created_at") _created_at = raw_input.get("source", {}).get("created_at") if raw_input.get("source") else "" self.created_at = created_at if created_at is not None else _created_at demisto.debug(f"Event init:{self.created_at=}") self.event_id = raw_input.get("event_id") self.event_type = raw_input.get("event_type") self.labels = raw_input demisto.debug(f"Useful current event info {self.event_id=} {self.event_type=} {raw_input=}") def format_incident(self): incident = { "name": f"Incident ID: {self.event_id} - {self.event_type}", "occurred": self.created_at, "rawJSON": json.dumps(self.labels), } return incident class Client(BaseClient): """ Client class to interact with the service API """ def __init__(self, base_url, verify, proxy, auth_params, as_user=None): try: self.credentials_dict = json.loads( auth_params.get("cred_json", {}).get("password") or auth_params.get("credentials_json", "{}") ) except ValueError as e: raise DemistoException("Failed to parse the credentials JSON. Please verify the JSON is valid.", exception=e) self.credentials = self.credentials_dict.get("boxAppSettings") self.client_id = self.credentials.get("clientID") self.app_auth = self.credentials.get("appAuth") self.client_secret = self.credentials.get("clientSecret") self.public_key_id = self.app_auth.get("publicKeyID") self.private_key = self.app_auth.get("privateKey") self.passphrase = self.app_auth.get("passphrase") self.enterprise_id = self.credentials_dict.get("enterpriseID") self.authentication_url = urljoin(base_url, "oauth2/token") self.as_user = as_user self.default_as_user = auth_params.get("default_user") self.search_user_id = auth_params.get("search_user_id", False) versioned_base_url = urljoin(base_url, "2.0") super().__init__(base_url=versioned_base_url, verify=verify, proxy=proxy) self._headers = self._request_token() def _decrypt_private_key(self): """ Attempts to load the private key as given in the integration configuration. :return: an initialized Private key object. """ try: key = load_pem_private_key( data=self.private_key.encode("utf8"), password=self.passphrase.encode("utf8"), backend=default_backend(), ) except (TypeError, ValueError, exceptions.UnsupportedAlgorithm) as exception: raise DemistoException("An error occurred while loading the private key.", exception) return key def _create_jwt_assertion(self): """ Establishes the claims based on information retrieved from the integration configuration. Afterwards the assertion is encoded to be sent as a parameter for the token request. :return: encoded jwt assertion object. """ if self.as_user: claims = { "iss": self.client_id, "sub": self.as_user, "box_sub_type": "user", "aud": self.authentication_url, "jti": secrets.token_hex(64), "exp": round(time.time()) + 45, } else: claims = { "iss": self.client_id, "sub": self.enterprise_id, "box_sub_type": "enterprise", "aud": self.authentication_url, "jti": secrets.token_hex(64), "exp": round(time.time()) + 45, } assertion = jwt.encode( payload=claims, key=self._decrypt_private_key(), algorithm="RS512", headers={"kid": self.public_key_id} ) return assertion def _request_token(self): """ Handles the actual request made to retrieve the access token. :return: Access token to be used in the authorization header for each request. """ params = { "grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer", "assertion": self._create_jwt_assertion(), "client_id": self.client_id, "client_secret": self.client_secret, } response = self._http_request(method="POST", url_suffix=None, full_url=self.authentication_url, json_data=params) access_token = response.get("access_token") auth_header = {"Authorization": f"Bearer {access_token}"} return auth_header def handle_as_user(self, as_user_arg: str | None) -> str: """ Wrapper which gracefully handles the as-user header variable as well as resolves an argument to an ID if the given argument is a users login and the search_user_id parameter is set. :param as_user_arg: Value for the argument as-user :return: Validated as_user id string. """ as_user = self._handle_default_user(as_user_arg=as_user_arg) if re.match(emailRegex, as_user): if self.search_user_id is True: # If the integration is configured to allow auto-detection of User IDs based on # emails, then the match is performed here. return self._search_user_id(as_user=as_user) else: raise DemistoException( "The current as-user is invalid. Please either specify the " "user ID, or enable the auto-detect user IDs setting." ) else: return as_user def _handle_default_user(self, as_user_arg: str | None) -> Union[str, Any]: """ When the as-user argument is absent when executing a command, this function will return the default user if there is one. If neither have been provided, we raise an error. :param as_user_arg: Value for the argument as-user :return: Correct as_user string. """ if as_user_arg is None: if not self.default_as_user: raise DemistoException( "A user ID has not been specified. Please configure a default, or add the user ID in the as_user argument." ) return self.default_as_user else: return as_user_arg def _search_user_id(self, as_user: str) -> str: """ When the search_user_id parameter is set, this function will resolve a users login to the users ID. :param as_user: Value for the as-user field. :return: resolved as_user ID. """ try: response = self.list_users(fields="id,name", filter_term=as_user, limit=1, offset=0) # In all cases, we retrieve the first (and ideally only) entry from the query. matched_user_id = response.get("entries")[0].get("id") except Exception as exception: raise DemistoException("An error occurred while attempting to match the as_user to a valid ID", exception) return str(matched_user_id) def search_content(self, as_user: str, query_object: QueryHandler) -> dict[str, Any]: """ Searches for files, folders, web links, and shared files across the users content or across the entire enterprise. :param as_user: str - the user ID of for whom the request is being made. :param query_object: QueryHandler - an object containing the data required for the query. :return: dict containing the results from the http request. """ validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix="/search/", params=query_object.prepare_params_object()) def find_file_folder_by_share_link(self, shared_link: str, password: str) -> dict[str, Any]: """ Return the file represented by a shared link. :param shared_link: str - the link which is being queried against. :param password: str - the password associated with the link. :return: dict containing the results from the http request. """ shared_link_header = f"shared_link={shared_link}" if password: password_header_part = f"&shared_link_password={password}" shared_link_header = shared_link_header + password_header_part self._headers.update({"BoxApi": shared_link_header}) return self._http_request(method="GET", url_suffix="shared_items/", resp_type="json") def get_shared_link_by_file(self, file_id: str, as_user: str) -> dict[str, Any]: """ Gets the shared link associated with a particular file. :param file_id: str - ID of the file. :param as_user: str - The ID of the user making the request. :return: dict containing the results from the http request. """ url_suffix = f"/files/{file_id}/" request_params = {"fields": "shared_link"} validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix, params=request_params) def crud_file_share_link(self, file_share_link: FileShareLink, as_user: str, is_delete: bool = False) -> dict[str, Any]: """ CRUD function which makes the request to the API based on the given parameters. :param file_share_link: FileShareLink object containing the formatted request object. :param as_user: str - The ID of the user making the request. :param is_delete: bool - Indicates if the request should result in the deletion of the share link. :return: dict containing the results from the http request. """ url_suffix = f"/files/{file_share_link.file_id}/" if not is_delete: request_body = file_share_link.prepare_request_object() else: request_body = None validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request( method="PUT", url_suffix=url_suffix, json_data={"shared_link": request_body}, params={"fields": "shared_link"} ) def get_shared_link_by_folder(self, folder_id: str, as_user: str): """ Handles the request to find a shared link based on the folder id. :param folder_id: str - The UUID of the folder to find a shared link for. :param as_user: str - The ID of the user making the request. :return: dict containing the results from the http request. """ url_suffix = f"/folders/{folder_id}/" request_params = {"fields": "shared_link"} validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix, params=request_params) def crud_folder_share_link(self, folder_share_link: FolderShareLink, as_user: str, is_delete: bool = False) -> dict[str, Any]: """ CRUD function which makes the request to the API based on the given parameters. :param folder_share_link: FolderShareLink object containing the formatted request object. :param as_user: str - The ID of the user making the request. :param is_delete: bool - Indicates if the request should result in the deletion of the share link. :return: dict containing the results from the http request. """ url_suffix = f"/folders/{folder_share_link.folder_id}/" if not is_delete: request_body = folder_share_link.prepare_request_object() else: request_body = None validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request( method="PUT", url_suffix=url_suffix, json_data={"shared_link": request_body}, params={"fields": "shared_link"} ) def get_folder(self, folder_id: str, as_user: str): """ Retrieves the folder's details based on the ID associated with the folder. :param folder_id: str - UUID for the folder. :param as_user: str - The ID of the user making the request. :return: dict containing the results from the http request. """ url_suffix = f"/folders/{folder_id}/" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix) def list_folder_items(self, folder_id: str, as_user: str, limit: int, offset: int, sort: str): """ Lists the items contained in a folder. Default limit established by Box is 50 items. :param folder_id: str - UUID for the folder. :param as_user: str - The ID of the user making the request. :param limit: - int - Limits the amount of results returned. :param offset: - int - Handles the index offset. Used for rudimentary pagination. :param sort: - str - ASC or DESC indicates the order to return results. :return: dict containing the results from the http request. """ url_suffix = f"/folders/{folder_id}/" request_params = {"limit": limit, "offset": offset, "sort": sort} validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix, params=request_params) def folder_create(self, name: str, parent_id: str, as_user: str): r""" Creates a folder with the given name. For files residing under the root of the users directory, please use '0'. :param name: str - The name of the folder. Must be ASCII characters and devoid of `/` or `\`. :param parent_id: - The ID of the folder which the folder will be created under. :param as_user: str - The ID of the user making the request. :return: dict containing the results from the http request. """ url_suffix = "/folders/" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request( method="POST", url_suffix=url_suffix, json_data={"name": name, "parent": {"id": parent_id}}, params={"fields": "shared_link"}, ) def file_delete(self, file_id: str, as_user: str): """ Deletes a file when given the file's UUID. :param file_id: str - UUID for the file. :param as_user: str - The ID of the user making the request. :return: Status code indicating success or not. """ url_suffix = f"/files/{file_id}" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="DELETE", url_suffix=url_suffix, return_empty_response=True) def list_users( self, fields: str = None, filter_term: str = None, limit: int = None, offset: int = None, user_type: str = None ): """ Lists the users found in the enterprise. Used for finding the `as_user` argument/parameter which is required to make requests on behalf of that user. :param fields: str - CSV string indicating which fields to search within - id,type,name. :param filter_term: str - The term used in the search. :param limit: int - limits the returned results. :param offset: int - Used for rudimentary pagination of results. :param user_type: str - Indicates the type of user being searched for. :return: dict containing the results from the http request. """ url_suffix = "/users/" query_params = {"fields": fields, "filter_term": filter_term, "limit": limit, "offset": offset, "user_type": user_type} return self._http_request(method="GET", url_suffix=url_suffix, params=remove_empty_elements(query_params)) def _create_upload_session(self, file_name: str | None, file_size: int, folder_id: str | None, as_user: str | None) -> dict: """ Each file upload where the file is greater than the maximum_chunk_size of 50MBs requires a session to be created. This session returns the endpoints and determined chunk size required by the Box API for chunked uploads. :param file_name: str - The name of the file being uploaded. Must contain an extension. :param file_size: int - Size of the file as determined by os.path.getsize() :param folder_id: str - The ID of the folder where the file will be uploaded to. :param as_user: str - The ID of the user making the request. :return: dict containing the details of the upload session. """ url_suffix = "/files/upload_sessions" self._base_url = "https://upload.box.com/api/2.0" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) upload_data = {"file_name": file_name, "file_size": file_size, "folder_id": folder_id} return self._http_request(method="POST", url_suffix=url_suffix, json_data=upload_data) @staticmethod def read_in_chunks(file_object: BinaryIO, chunk_size: int = 65536): """ Generator function used to read the file according to the chunk_size given by the Box API. :param file_object: BinaryIO object of the file. :param chunk_size: int - Size of the required chunks :return: Iterator containing file objects of the determined size. """ while True: data = file_object.read(chunk_size) if not data: break yield data def chunk_upload(self, file_name: str | None, file_size: int, file_path: str, folder_id: str | None, as_user: str | None): """ Handles the uploading of the file parts to the session endpoint. Box requires a SHA1 digest hash to be included as part of the request headers. This function handles that as it iterates over the file object. :param file_name: str - The name of the file. :param file_size: int - The size of the file in bytes. :param file_path: str - The path of where the file is located. Used for reading the file. :param folder_id: str - The folder ID for the parent folder which will contain the file. :param as_user: str - The ID of the user making the request. :return: tuple - parts - list - an array of dictionaries containing details of the part which was uploaded. - upload_url_suffix - str - The endpoint used for uploading the file. Used in the request made to commit the file once it has been uploaded. """ upload_session_data = self._create_upload_session( file_name=file_name, file_size=file_size, folder_id=folder_id, as_user=as_user ) session_id: str = upload_session_data.get("id") # type:ignore part_size: int = upload_session_data.get("part_size") # type:ignore upload_url_suffix = f"/files/upload_sessions/{session_id}" parts = [] index = 0 with open(file_path, "rb") as file_object: for chunk in self.read_in_chunks(file_object, part_size): content_sha1 = sha1() # nosec content_sha1.update(chunk) part_content_sha1 = content_sha1.digest() offset = index + len(chunk) self._headers.update( { "Content-Type": "application/octet-stream", "As-User": as_user, "Content-length": str(file_size), "Content-Range": f"bytes {index}-{offset - 1}/{file_size}", "Digest": f"SHA={base64.b64encode(part_content_sha1).decode('utf-8')}", } ) r = self._http_request(method="PUT", url_suffix=upload_url_suffix, data=chunk) parts.append(r.get("part")) index = offset return parts, upload_url_suffix def commit_file(self, file_path: str, as_user: str | None, parts: list[dict], upload_url_suffix: str) -> dict: """ Once a file has been uploaded, the file must be committed. This request requires the SHA1 digest of the entire file to be sent in the header. We reread the file to ensure the SHA is calculated properly. :param file_path: str - Path of where the file is located. :param as_user: str - The ID of the user making the request. :param parts: - list[dicts] - Contains information returned by the API for each part which was uploaded. :param upload_url_suffix: - str - The url suffix used to commit the file. (unique and given only after requesting the upload session) :return: dict containing the results of the upload session. """ with open(file_path, "rb") as file_obj: final_sha = sha1() # nosec final_sha.update(file_obj.read()) whole_file_sha_digest = final_sha.digest() final_headers = { "Content-Type": "application/json", "As-User": as_user, "Digest": f"SHA={base64.b64encode(whole_file_sha_digest).decode('utf-8')}", "Authorization": self._headers.get("Authorization"), } return self._http_request( method="POST", url_suffix=upload_url_suffix + "/commit", json_data={"parts": parts}, headers=final_headers ) def upload_file( self, entry_id: str, file_name: str | None = None, folder_id: str | None = None, as_user: str | None = None ) -> dict: """ Main function used to handle the `box-upload-file` command. Box enforces size limitations which determines which endpoint is used to upload a file. for files under 50MB, the generic endpoint is used. For files over 50MB, an upload session must be requested. :param entry_id: str - Entry ID of the file uploaded to the war room. :param file_name: str - Name which the file will be saved as. Must contain an extension. :param folder_id: str - The UUID of the folder which the file will be contained in. :param as_user: str - The ID of the user making the request. :return: dict containing the results of the upload request. """ self._base_url = "https://upload.box.com/api/2.0" # Because of _course_ they have a separate base_url for uploads maximum_chunk_size = 20000000 demisto_file_object = demisto.getFilePath(entry_id) if not file_name: file_name = demisto_file_object.get("name") # Box requires files to have a file extension. We validate that here. if "." not in file_name: # type: ignore raise DemistoException("A file extension is required in the filename.") file_path = demisto_file_object.get("path") file_size = os.path.getsize(file_path) if file_size > maximum_chunk_size: parts, upload_url_suffix = self.chunk_upload(file_name, file_size, file_path, folder_id, as_user) return self.commit_file(file_path, as_user, parts, upload_url_suffix) else: with open(file_path, "rb") as file: validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) upload_url_suffix = "/files/content" attributes = {"name": file_name, "parent": {"id": folder_id}} data = {"attributes": json.dumps(attributes)} files = {"file": ("unused", file)} return self._http_request(method="POST", url_suffix=upload_url_suffix, data=data, files=files) def trashed_items_list(self, as_user: str, limit: int, offset: int): """ Lists the items which have been sent to trash by the user making the request. :param as_user: str - The ID of the user making the request. :param limit: int - The maximum amount of results to return. :param offset: int - Used for rudimentary pagination. :return: dict containing the results of the request. """ url_suffix = "/folders/trash/items/" request_params = {"limit": limit, "offset": offset} validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix, params=request_params) def trashed_item_restore(self, item_id: str, type: str, as_user: str): """ Uses the item_id and item type to restore the item once it has been deleted. :param item_id: str - The UUID of the item being restored. :param type: str - The type of item being restored. file or folder. :param as_user: str - The ID of the user making the request. :return: dict containing the results of the request. """ # The url requires a plural version of the item. url_suffix = f'/{type + "s"}/{item_id}' validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="POST", url_suffix=url_suffix) def trashed_item_permanently_delete(self, item_id: str, type: str, as_user: str): """ Permanently deletes an item which has been trashed. Please note this can only be performed on items which have already been trashed. :param item_id: str - UUID of the item to be permanently deleted. :param type: str - The type of the item. :param as_user: str - The ID of the user making the request. :return: Status code indicating success/failure of the request. """ url_suffix = f'/{type + "s"}/{item_id}/trash/' validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="DELETE", url_suffix=url_suffix, return_empty_response=True) def list_events( self, as_user: str, stream_type: str, created_after: str = None, limit: int = None, event_type: str = None, next_stream_position: str = None, ): """ Lists the events which have occurred given the as_user argument/parameter. Same endpoint is used to also handle the enterprise logs as well. :param as_user: str - The ID of the user making the request. :param stream_type: str - Indicates the type of logs to be retrieved. :param created_after: str - Is used the return only events created after the given time. :param limit: int - The maximum amount of events to return. :param event_type: a comma separated list of Event types to return. :param next_stream_position: The location in the event stream to start receiving events from. :return: dict - The results for the given logs query. """ url_suffix = "/events/" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) request_params = {"stream_type": stream_type} if created_after: request_params.update({"created_after": created_after}) if limit: request_params.update({"limit": limit}) # type:ignore if event_type: request_params.update({"event_type": event_type}) if next_stream_position: request_params.update({"stream_position": next_stream_position}) demisto.debug(f"The command with {url_suffix=}, params are {request_params=}") return self._http_request(method="GET", url_suffix=url_suffix, params=request_params) def get_current_user(self, as_user: str): """ Gets the details for the user currently logged in. The current user is identified by the `As-User` header value. :param as_user: str - The ID of the user making the request. :return: dict - The details for the current user. """ url_suffix = "/users/me/" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) return self._http_request(method="GET", url_suffix=url_suffix) def create_update_user( self, as_user: str = None, login: str = None, name: str = None, role: str = None, language: str = None, is_sync_enabled: bool = False, job_title: str = None, phone: str = None, address: str = None, space_amount: int = None, tracking_codes: list[dict] = None, can_see_managed_users: bool = False, time_zone: str = None, is_exempt_from_device_limits: bool = False, is_exempt_from_login_verification: bool = False, is_external_collab_restricted: bool = False, is_platform_access_only: bool = False, status: str = None, user_id: str = None, update_user: bool = False, is_update: bool = False, ) -> dict: """ This function handles the creation and update of users for Box. The same request object is sent for both calls. :param update_user: bool - Indicates if the function should update the user instead of create one. :param user_id: str - The ID of the user. Only used for updates. :param as_user: str - The ID of the user making the request. :param login: str - The email which will be used to login. :param name: str - The name of the user. :param role: str - The role for the user's account. (user, admin, etc.) :param language: str - ISO639 formatted str for the language (e.g. EN for English) :param is_sync_enabled: bool - Indicates if sync will be enabled on the account. :param job_title: str - The job title for the user. :param phone: int - The user's phone number. Non integer characters are not valid. :param address: str - The address for the user. :param space_amount: int - Space in bytes which are allocated to the user. :param tracking_codes: List[Dict] - Array containing key value pairs as defined by the admin. :param can_see_managed_users: bool - Indicates if this user can see managed users. :param time_zone: str - The timezone of the user. e.g. US/Eastern. :param is_exempt_from_device_limits: bool - Indicates if user is exempt from device limits. :param is_exempt_from_login_verification: bool - Indicates if user is exempt for login verification :param is_external_collab_restricted: bool - Indicates if user is collab restricted. :param is_platform_access_only: bool - Indicates if user has acces to only the platform. :param status: str - The account status for the user. e.g. `active` :return: dict - The details of the created user. """ if update_user: url_suffix = f"/users/{user_id}/" method = "PUT" else: url_suffix = "/users/" method = "POST" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) request_body = { "role": role, "address": address, "job_title": job_title, "language": language, "login": login, "name": name, "phone": phone, "space_amount": space_amount, "status": status, "timezone": time_zone, "is_sync_enabled": is_sync_enabled, "is_exempt_from_device_limits": is_exempt_from_device_limits, "is_external_collab_restricted": is_external_collab_restricted, "is_exempt_from_login_verification": is_exempt_from_login_verification, "can_see_managed_users": can_see_managed_users, "tracking_codes": tracking_codes, } if is_update is False: request_body.update({"is_platform_access_only": is_platform_access_only}) return self._http_request(method=method, url_suffix=url_suffix, json_data=remove_empty_elements(request_body)) def delete_user(self, as_user: str, user_id: str, force: bool = False): """ Deletes a user with the given `user_id`. If force is True, then the user will be deleted including all of their files. If not, then all files must be moved before deletion. :param as_user: str - The user who is making the request. :param user_id: str - The ID of the user who is being deleted. :param force: bool - Indicates if the command will be executed forcefully. :return: Status code indicating success or not. """ url_suffix = f"/users/{user_id}/" validated_as_user = self.handle_as_user(as_user_arg=as_user) self._headers.update({"As-User": validated_as_user}) query_params = {"force": force} return self._http_request(method="DELETE", url_suffix=url_suffix, params=query_params, return_empty_response=True) def download_file(self, file_id: str): """ Downloads a file with the given `file_id`. :param file_id: str - The ID of the file to download. :return: Status code indicating success or not. """ url_suffix = f"/files/{file_id}/content/" return self._http_request(method="GET", resp_type="response", url_suffix=url_suffix, return_empty_response=True) def move_folder(self, from_user_id: str, to_user_id: str, notify: bool = False): """ Moves the folders from one user to another. Please note, only the root "0" folder can be moved to another user. This operation also requires the "Read and write all files and folders stored in Box" permission scope. :param from_user_id: str - The ID of the user who currently owns the folder. :param to_user_id: str - The ID of the user to acquire the folder. :param notify: bool - Indicates if the users should receive an email notification. :return: Status code indicating success or not. """ url_suffix = f"/users/{from_user_id}/folders/0/" query_params = {"notify": notify} request_body = {"owned_by": {"id": to_user_id}} return self._http_request(method="PUT", url_suffix=url_suffix, params=query_params, json_data=request_body, timeout=30) """ HELPER FUNCTIONS """ def get_filename(header_string: str): """ Retrieves the file name from a header response. :param header_string: String containing the header object. :return: name of file if found, if not returns temp name. """ try: file_name = re.findall(r"filename\*?=([^;]+)", header_string, flags=re.IGNORECASE) return file_name[0].strip().strip('"') except ValueError: return "retrieved_file" def arg_to_int(arg: Any, arg_name: str, default: int = None) -> int: """Converts an XSOAR argument to a Python int This function is used to quickly validate an argument provided to XSOAR via ``demisto.args()`` into an ``int`` type. :type arg: ``Any`` :param arg: argument to convert :type arg_name: ``str`` :param arg_name: argument name :type default: ``int`` :param default: Provides a default value if the arg is None. :return: returns an ``int`` if arg can be converted returns ``None`` if arg is ``None`` and required is set to ``False`` otherwise throws an Exception :rtype: ``int`` """ if arg is None: return default # type:ignore if isinstance(arg, str): if arg.isdigit(): return int(arg) raise ValueError(f'Invalid number: "{arg_name}"="{arg}"') if isinstance(arg, int): return arg raise ValueError(f'Invalid number: "{arg_name}"') def arg_to_timestamp(arg: Any, arg_name: str, required: bool = False) -> int | None: """Converts an XSOAR argument to a timestamp (seconds from epoch) This function is used to quickly validate an argument provided to XSOAR via ``demisto.args()`` into an ``int`` containing a timestamp (seconds since epoch). It will throw a ValueError if the input is invalid. If the input is None, it will throw a ValueError if required is ``True``, or ``None`` if required is ``False. :type arg: ``Any`` :param arg: argument to convert :type arg_name: ``str`` :param arg_name: argument name :type required: ``bool`` :param required: throws exception if ``True`` and argument provided is None :return: returns an ``int`` containing a timestamp (seconds from epoch) if conversion works returns ``None`` if arg is ``None`` and required is set to ``False`` otherwise throws an Exception :rtype: ``Optional[int]`` """ if arg is None: if required is True: raise ValueError(f'Missing "{arg_name}"') return None if isinstance(arg, str) and arg.isdigit(): # timestamp is a str containing digits - we just convert it to int return int(arg) if isinstance(arg, str): # we use dateparser to handle strings either in ISO8601 format, or # relative time stamps. # For example: format 2019-10-23T00:00:00 or "3 days", etc date = dateparser.parse(arg, settings={"TIMEZONE": "UTC"}) if date is None: # if d is None it means dateparser failed to parse it raise ValueError(f"Invalid date: {arg_name}") return int(date.timestamp()) if isinstance(arg, int | float): # Convert to int if the input is a float return int(arg) raise ValueError(f'Invalid date: "{arg_name}"') def format_time_range(range_arg: str): """ Formats time range arguments since Box requires the format as a CSV string. :param range_arg: :return: Returns a formatted string or None depending on the input. """ if range_arg: dt_from, dt_to = parse_date_range(date_range=range_arg, date_format=DATE_FORMAT) return f"{dt_from},{dt_to}" else: return None def parse_key_value_arg(arg_str: Any | None): """ In some cases it is necessary to pass an argument with a specific name. The common usecase is for Tags. This function allows a user to create their own key value pairs. :param arg_str: Argument given as a string in the format `key1:value1,key2:value2` :return: List of sets. """ if arg_str: tags = [] for item in arg_str.split(","): try: key, value = item.split(":") except ValueError: raise DemistoException(f"Got invalid key/value pair {item}.") tags.append({key.strip(): value.strip()}) return tags else: return None """ COMMAND FUNCTIONS """ def find_file_folder_by_share_link_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which retrieves the file or folder for a given share link. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ share_link: str = args.get("shared_link") # type:ignore password: str = args.get("password", None) response: dict = client.find_file_folder_by_share_link(shared_link=share_link, password=password) readable_output = tableToMarkdown( name=f"File/Folder Share Link for {share_link}", t=response, removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.ShareLink", outputs_key_field="shared_link", outputs=response ) def search_content_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which uses the `search_content` client function to query for an item. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ query_object = QueryHandler(args=args) as_user: str = args.get("as_user") # type:ignore response = client.search_content(as_user=as_user, query_object=query_object) readable_output = tableToMarkdown( name="Search results", t=response.get("entries"), removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.Query", outputs_key_field="id", outputs=response.get("entries") ) def create_update_file_share_link_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which uses the `crud_file_share_link` client function to create or update a file's share link. Since the API does not differentiate between creation or update of the links, this function handles both use-cases. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to initiate the FileShareLink object and pass the `as_user` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ file_share_link_obj: FileShareLink = FileShareLink(args) as_user: str = args.get("as_user") # type:ignore response: dict = client.crud_file_share_link(file_share_link=file_share_link_obj, as_user=as_user) readable_output = tableToMarkdown( name=f"File Share Link was created/updated for file_id: {file_share_link_obj.file_id}", t=response.get("shared_link"), removeNull=True, headerTransform=string_to_table_header, ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.ShareLink", outputs_key_field="id", outputs=response ) def remove_file_share_link_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which uses the `crud_file_share_link` client function to delete/remove a file's share link. This is done by passing the `is_delete` parameter to the crud function which sends an empty JSON object to the API. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to initiate the FileShareLink object and pass the `as_user` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ file_share_link_obj: FileShareLink = FileShareLink(args) as_user: str = args.get("as_user") # type:ignore response: dict = client.crud_file_share_link(file_share_link=file_share_link_obj, as_user=as_user, is_delete=True) return CommandResults( readable_output=f"File Share Link for the file_id {file_share_link_obj.file_id} was removed.", outputs_prefix="Box.ShareLink", outputs_key_field="id", outputs=response, ) def get_shared_link_for_file_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which retrieves the shared link for a given file. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the `as_user` and `file_id` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ file_id: str = args.get("file_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.get_shared_link_by_file(file_id=file_id, as_user=as_user) if response.get("shared_link") is None: readable_output: str = f"There currently is no shared link assigned to the file {file_id}." else: readable_output: str = tableToMarkdown( # type:ignore name=f"Shared link information for the file {file_id}", t=response.get("shared_link"), removeNull=True, headerTransform=string_to_table_header, ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.ShareLink", outputs_key_field="id", outputs=response ) def get_shared_link_by_folder_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which retrieves the shared link for a given folder. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the `as_user` and `folder_id` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ folder_id: str = args.get("folder_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.get_shared_link_by_folder(folder_id=folder_id, as_user=as_user) readable_output: str = tableToMarkdown( name=f"Shared link information for the folder {folder_id}", t=response, removeNull=True, headerTransform=string_to_table_header, ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.FolderShareLink", outputs_key_field="id", outputs=response ) def create_update_folder_share_link_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which uses the `crud_folder_share_link` client function to create or update a folder's share link. Since the API does not differentiate between creation or update of the links, this function handles both use-cases. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to initiate the FolderShareLink object and pass the `as_user` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ folder_share_link_obj: FolderShareLink = FolderShareLink(args) as_user: str = args.get("as_user") # type:ignore response: dict = client.crud_folder_share_link(folder_share_link=folder_share_link_obj, as_user=as_user) readable_output: str = tableToMarkdown( name=f"Folder Share Link for {folder_share_link_obj.folder_id}", t=response, removeNull=True, headerTransform=string_to_table_header, ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.ShareLink", outputs_key_field="id", outputs=response ) def remove_folder_share_link_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command function which uses the `crud_folder_share_link` client function to delete/remove a folder's share link. This is done by passing the `is_delete` parameter to the crud function which sends an empty JSON object to the API. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to initiate the FolderShareLink object and pass the `as_user` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ folder_share_link_obj: FolderShareLink = FolderShareLink(args) as_user: str = args.get("as_user") # type:ignore response: dict = client.crud_folder_share_link(folder_share_link=folder_share_link_obj, as_user=as_user, is_delete=True) readable_output: str = tableToMarkdown( name=f"Folder Share Link for {folder_share_link_obj.folder_id} was removed.", t=response, removeNull=True, headerTransform=string_to_table_header, ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.ShareLink", outputs_key_field="id", outputs=response ) def get_folder_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command which retrieves details about a given folder. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the `as_user` and `folder_id` argument to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ folder_id: str = args.get("folder_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.get_folder(folder_id=folder_id, as_user=as_user) folder_item_collection: dict = response.get("item_collection") # type:ignore folders_output: str = tableToMarkdown( name=f"File contents for the folder {folder_id}", t=folder_item_collection.get("entries"), removeNull=True, headerTransform=string_to_table_header, ) overview_response = response.copy() overview_response.pop("item_collection") overview_output: str = tableToMarkdown( name=f"Folder overview for {folder_id}.", t=overview_response, removeNull=True, headerTransform=string_to_table_header ) readable_output: str = overview_output + folders_output return CommandResults(readable_output=readable_output, outputs_prefix="Box.Folder", outputs_key_field="id", outputs=response) def list_folder_items_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command which lists the items within a given folder. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ folder_id: str = args.get("folder_id") # type:ignore as_user: str = args.get("as_user") # type:ignore limit: int = arg_to_int(arg_name="limit", arg=args.get("limit"), default=100) offset: int = arg_to_int(arg_name="offset", arg=args.get("offset"), default=0) sort: str = args.get("sort") # type:ignore response: dict = client.list_folder_items(folder_id=folder_id, as_user=as_user, limit=limit, offset=offset, sort=sort) folder_item_collection: dict = response.get("item_collection") # type:ignore folders_output: str = tableToMarkdown( name=f"File contents for the folder {folder_id}", t=folder_item_collection.get("entries"), removeNull=True, headerTransform=string_to_table_header, ) overview_response = response.copy() overview_response.pop("item_collection") overview_output: str = tableToMarkdown( name=f"Folder overview for {folder_id}.", t=overview_response, removeNull=True, headerTransform=string_to_table_header ) readable_output: str = overview_output + folders_output return CommandResults(readable_output=readable_output, outputs_prefix="Box.Folder", outputs_key_field="id", outputs=response) def folder_create_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command which creates a folder under the given parent folder. If no parent is given, the folder will be created under the root (0) folder. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ name: str = args.get("name") # type:ignore parent_id: str = args.get("parent_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.folder_create(name=name, parent_id=parent_id, as_user=as_user) readable_output: str = f"Folder named {name}, was successfully created." return CommandResults(readable_output=readable_output, outputs_prefix="Box.Folder", outputs_key_field="id", outputs=response) def file_delete_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command which when given a file_id will delete the file. The deleted file will be sent to the Trash folder. If the file is to be deleted permanently, then it is necessary to use the `box-trashed-item-delete-permanently` command after executing this command. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ file_id: str = args.get("file_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: Response = client.file_delete(file_id=file_id, as_user=as_user) if response.status_code == 204: readable_output: str = f"The file {file_id} was successfully deleted." else: readable_output: str = f"The file {file_id} was not deleted successfully." # type:ignore raise DemistoException(readable_output) return CommandResults(readable_output=readable_output) def list_users_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command which will list all users for which the query applies. The retrieved user_ids are necessary for subsequent calls made to the API. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ fields: str = args.get("fields") # type:ignore filter_term: str = args.get("filter_term") # type:ignore limit: int = arg_to_int(arg_name="limit", arg=args.get("limit"), default=100) offset: int = arg_to_int(arg_name="offset", arg=args.get("offset"), default=0) user_type: str = args.get("user_type") # type:ignore response: dict = client.list_users(fields=fields, filter_term=filter_term, limit=limit, offset=offset, user_type=user_type) readable_output: str = tableToMarkdown( name="The following users were found.", t=response.get("entries"), removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.Users", outputs_key_field="id", outputs=response.get("entries") ) def upload_file_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Uploads a file to Box. For files with a size over the set limit, the file will be uploaded in chunks. For files which are under the limit, they will be submitted using a POST request. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ entry_id: str = args.get("entry_id") # type:ignore file_name: str = args.get("file_name") # type:ignore folder_id: str = args.get("folder_id") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.upload_file(entry_id=entry_id, file_name=file_name, folder_id=folder_id, as_user=as_user) readable_output = "File was successfully uploaded" return CommandResults( readable_output=readable_output, outputs_prefix="Box.File", outputs_key_field="id", outputs=response.get("entities") ) def trashed_items_list_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Lists items which have been trashed. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ limit: int = arg_to_int(arg_name="limit", arg=args.get("limit"), default=100) offset: int = arg_to_int(arg_name="offset", arg=args.get("offset"), default=0) as_user: str = args.get("as_user") # type:ignore response: dict = client.trashed_items_list(limit=limit, offset=offset, as_user=as_user) if len(response.get("entries")) == 0: # type:ignore readable_output = "No trashed items were found." else: readable_output = tableToMarkdown( name="Trashed items were found.", t=response.get("entries"), removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.Trash", outputs_key_field="id", outputs=response.get("entries") ) def trashed_item_restore_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Restores an item which has been trashed. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ item_id: str = args.get("item_id") # type:ignore type: str = args.get("type") # type:ignore as_user: str = args.get("as_user") # type:ignore response: dict = client.trashed_item_restore(item_id=item_id, type=type, as_user=as_user) readable_output = f"Item with the ID {item_id} was restored." return CommandResults(readable_output=readable_output, outputs_prefix="Box.Item", outputs_key_field="id", outputs=response) def trashed_item_delete_permanently_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Permanently deletes a file. Please note, the file must be sent to trash prior to permanent deletion. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ item_id: str = args.get("item_id") # type:ignore type: str = args.get("type") # type:ignore as_user: str = args.get("as_user") # type:ignore response: Response = client.trashed_item_permanently_delete(item_id=item_id, type=type, as_user=as_user) if response.status_code == 204: readable_output = f"Item with the ID {item_id} was deleted permanently." else: readable_output = f"Failed to delete the item - {item_id}." return CommandResults(readable_output=readable_output) def list_user_events_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Retrieves events which were generated by a specific user. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore stream_type: str = args.get("stream_type") # type:ignore limit: int = arg_to_int(arg_name="limit", arg=args.get("limit"), default=10) response: dict = client.list_events(as_user=as_user, stream_type=stream_type, limit=limit) events = response.get("entries", []) if len(events) == 0: # type:ignore readable_output = f"No events were found for the user {as_user}." else: readable_output = tableToMarkdown( name=f"Events found for the user: {as_user}", t=events, removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.Events", outputs_key_field="event_id", outputs=events ) def list_enterprise_events_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Retrieves enterprise level events from the Box service. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore limit: int = arg_to_int(arg_name="limit", arg=args.get("limit"), default=10) created_after: str = arg_to_datetime( # type:ignore arg=args.get("created_after"), arg_name="Created after", required=False ).strftime(DATE_FORMAT) response: dict = client.list_events(as_user=as_user, stream_type="admin_logs", created_after=created_after, limit=limit) events = response.get("entries", []) if len(events) == 0: # type:ignore readable_output = "No enterprise events were found." else: readable_output = tableToMarkdown( name="Enterprise Events found.", t=events, removeNull=True, headerTransform=string_to_table_header ) return CommandResults( readable_output=readable_output, outputs_prefix="Box.Events", outputs_key_field="event_id", outputs=events ) def get_current_user_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command executed when `box-get-current-user` is called. Uses the `As-User` header parameter to set the current user for the request. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore response: dict = client.get_current_user(as_user=as_user) readable_output = tableToMarkdown( name=f'The current user is {response.get("login")}.', t=response, removeNull=True, headerTransform=string_to_table_header ) return CommandResults(readable_output=readable_output, outputs_prefix="Box.User", outputs_key_field="id", outputs=response) def create_user_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command executed when `box-create_user` is called. Will create a user based on the given arguments. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore login: str = args.get("login") # type:ignore name: str = args.get("name") # type:ignore role: str = args.get("role") # type:ignore language: str = args.get("language") # type:ignore is_sync_enabled: bool = argToBoolean(args.get("is_sync_enabled")) job_title: str = args.get("job_title") # type:ignore phone: str = args.get("phone") # type:ignore address: str = args.get("address") # type:ignore space_amount: int = arg_to_int(arg_name="space_amount", arg=args.get("space_amount"), default=-1) tracking_codes: list[dict] = parse_key_value_arg(arg_str=args.get("tracking_codes")) can_see_managed_users: bool = argToBoolean(args.get("can_see_managed_users")) time_zone: str = args.get("timezone") # type:ignore is_exempt_from_device_limits: bool = argToBoolean(args.get("is_exempt_from_device_limits")) is_exempt_from_login_verification: bool = argToBoolean(args.get("is_exempt_from_login_verification")) is_external_collab_restricted: bool = argToBoolean(args.get("is_external_collab_restricted")) is_platform_access_only: bool = argToBoolean(args.get("is_platform_access_only")) status: str = args.get("status") # type:ignore if is_platform_access_only is False and login is None: raise DemistoException("Box requires the Login argument when the argument `is_platform_access_only` is False") response = client.create_update_user( as_user=as_user, login=login, name=name, role=role, language=language, is_sync_enabled=is_sync_enabled, job_title=job_title, phone=phone, address=address, space_amount=space_amount, tracking_codes=tracking_codes, can_see_managed_users=can_see_managed_users, time_zone=time_zone, is_exempt_from_device_limits=is_exempt_from_device_limits, is_exempt_from_login_verification=is_exempt_from_login_verification, is_external_collab_restricted=is_external_collab_restricted, is_platform_access_only=is_platform_access_only, status=status, ) readable_output = tableToMarkdown( name=f'The user {response.get("login")} has been created.', t=response, removeNull=True, headerTransform=string_to_table_header, ) return CommandResults(readable_output=readable_output, outputs_prefix="Box.User", outputs_key_field="id", outputs=response) def update_user_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command executed when `box-create_user` is called. Will create a user based on the given arguments. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore user_id: str = args.get("user_id") # type:ignore login: str = args.get("login") # type:ignore name: str = args.get("name") # type:ignore role: str = args.get("role") # type:ignore language: str = args.get("language") # type:ignore is_sync_enabled: bool = argToBoolean(args.get("is_sync_enabled", "false")) # type:ignore job_title: str = args.get("job_title") # type:ignore phone: str = args.get("phone") # type:ignore address: str = args.get("address") # type:ignore space_amount: int = arg_to_int(arg_name="space_amount", arg=args.get("space_amount"), default=-1) tracking_codes: Any | None = parse_key_value_arg(arg_str=args.get("tracking_codes")) can_see_managed_users: bool = argToBoolean(args.get("can_see_managed_users", "false")) # type:ignore time_zone: Any | None = args.get("timezone") is_exempt_from_device_limits: bool = argToBoolean(args.get("is_exempt_from_device_limits", "false")) # type:ignore is_exempt_from_login_verification: bool = argToBoolean(args.get("is_exempt_from_login_verification", "false")) # type:ignore is_external_collab_restricted: bool = argToBoolean(args.get("is_external_collab_restricted", "false")) # type:ignore status: Any | None = args.get("status") response = client.create_update_user( as_user=as_user, login=login, name=name, role=role, language=language, is_sync_enabled=is_sync_enabled, job_title=job_title, phone=phone, address=address, space_amount=space_amount, tracking_codes=tracking_codes, can_see_managed_users=can_see_managed_users, time_zone=time_zone, is_exempt_from_device_limits=is_exempt_from_device_limits, is_exempt_from_login_verification=is_exempt_from_login_verification, is_external_collab_restricted=is_external_collab_restricted, status=status, user_id=user_id, update_user=True, is_update=True, ) readable_output = tableToMarkdown( name=f'The user {response.get("login")} has been updated.', t=response, removeNull=True, headerTransform=string_to_table_header, ) return CommandResults(readable_output=readable_output, outputs_prefix="Box.User", outputs_key_field="id", outputs=response) def delete_user_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command executed when `box-create_user` is called. Will create a user based on the given arguments. :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ as_user: str = args.get("as_user") # type:ignore user_id: str = args.get("user_id") # type:ignore force: bool = argToBoolean(args.get("force", "false")) response = client.delete_user(as_user=as_user, user_id=user_id, force=force) if response.status_code == 204: readable_output: str = f"The user {user_id} was successfully deleted." else: readable_output: str = f"The user {user_id} was not deleted successfully." # type: ignore raise DemistoException(readable_output) return CommandResults(readable_output=readable_output) def download_file_command(auth_params: dict, base_url: str, verify: bool, proxy: bool, args: dict[str, Any]) -> dict: """ Command executed when `box-download-file` is called. Will download a file based on the given arguments. This function requires a new JWT grant to be created with the explicit permissions of the user who is downloading the file. This is why we are throwing away the main client and building a new one here. :param proxy: Indicates if using a proxy. :param verify: Indicates if the client will verify self signed certs :param base_url: Base URL for the service :param auth_params: Args used for the authentication :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ file_id: str = args.get("file_id") # type:ignore as_user: str = args.get("as_user") # type:ignore download_client = Client(auth_params=auth_params, base_url=base_url, verify=verify, proxy=proxy, as_user=as_user) response = download_client.download_file(file_id=file_id) d = response.headers["content-disposition"] file_name = get_filename(d) return fileResult(filename=file_name, data=response.content) def move_folder_command(client: Client, args: dict[str, Any]) -> CommandResults: """ Command executed when `box-move-folder` is called. Will move the folder from one user to another :param client: Client - Initialized Client object. :param args: demisto.args() dictionary - Used to pass the necessary arguments to the client function. :return: CommandResults - Returns a CommandResults object which is consumed by the return_results function in main() """ from_user_id: str = args.get("from_user_id") # type:ignore to_user_id: str = args.get("to_user_id") # type:ignore notify: bool = argToBoolean(args.get("notify", "true")) response = client.move_folder(from_user_id=from_user_id, to_user_id=to_user_id, notify=notify) readable_output: str = tableToMarkdown( name="Folder overview for transferred folder.", t=response, removeNull=True, headerTransform=string_to_table_header ) return CommandResults(readable_output=readable_output, outputs_prefix="Box.Folder", outputs_key_field="id", outputs=response) """ MAIN FUNCTION """ def test_module(client: Client, params: dict, first_fetch_time: int) -> str: """ This test assumes that the account has at least one user. By definition, if the instance is configured correctly, there will always be a minimum of one user. :param client: Initiated Client object. :param params: Parameters given to Demisto in the integration config. :param first_fetch_time: Int to be used to create a created_after timestamp. :return: Test result. """ if params.get("default_user"): response = client.get_current_user(params.get("default_user")) # type:ignore elif params.get("isFetch"): if not params.get("as_user"): raise DemistoException("In order to use fetch, a User ID for Fetching Incidents is required.") created_after = datetime.fromtimestamp(first_fetch_time, tz=UTC).strftime(DATE_FORMAT) response = client.list_events( as_user=params.get("as_user"), # type:ignore created_after=created_after, stream_type="admin_logs", limit=1, ) else: response: Response = client.list_users(limit=1) # type:ignore if response: return "ok" else: return "An error occurred." def fetch_incidents( client: Client, max_results: int, last_run: dict, first_fetch_time: int, as_user: str, event_type: list = None ) -> tuple[dict, list[dict]]: """ :param client: :param max_results: :param last_run: :param first_fetch_time: :param as_user: :param event_type: :return: """ created_after = last_run.get("time", None) next_stream_position = last_run.get("next_stream_position", "") incidents = [] if not created_after: created_after = datetime.fromtimestamp(first_fetch_time, tz=UTC).strftime(DATE_FORMAT) demisto.debug(f"At the beginning of the fetch, {created_after=} {next_stream_position=}") event_type_str = ",".join(event_type) if event_type else "" demisto.debug(f"{event_type_str=}") results = client.list_events( stream_type="admin_logs", as_user=as_user, limit=max_results, created_after=created_after, event_type=event_type_str, next_stream_position=next_stream_position, ) raw_incidents = results.get("entries", []) next_stream_position = results.get("next_stream_position") demisto.debug(f"Extracted {len(raw_incidents)} raw incidents from the results.") next_run = created_after for raw_incident in raw_incidents: event = Event(raw_input=raw_incident) xsoar_incident = event.format_incident() incidents.append(xsoar_incident) utc_event_time = arg_to_datetime(event.created_at) utc_event_time = utc_event_time.strftime(DATE_FORMAT) if utc_event_time else "" next_run = arg_to_datetime(next_run) next_run = next_run.strftime(DATE_FORMAT) if next_run else "" demisto.debug(f"{utc_event_time=} >? {next_run=}") if utc_event_time > next_run: next_run = utc_event_time last_run = {"time": next_run, "next_stream_position": next_stream_position} demisto.debug(f"The final {last_run=}") return last_run, incidents def main() -> None: # pragma: no cover """main function, parses params and runs command functions :return: :rtype: """ # get the service API url demisto_params = demisto.params() verify_certificate = not demisto.params().get("insecure", False) # Determine first fetch time if none is found. first_fetch_time = arg_to_timestamp( arg=demisto.params().get("first_fetch", "1 day"), arg_name="First fetch time", required=True ) if not isinstance(first_fetch_time, int): raise DemistoException("An error occurred while creating the first fetch time.") proxy = demisto.params().get("proxy", False) demisto.debug(f"Command being called is {demisto.command()}") try: client = Client( auth_params=demisto.params(), base_url=demisto_params.get("url", "https://api.box.com"), verify=verify_certificate, proxy=proxy, ) if demisto.command() == "test-module": result = test_module(client, params=demisto.params(), first_fetch_time=first_fetch_time) return_results(result) elif demisto.command() == "fetch-incidents": as_user = demisto.params().get("as_user", None) event_type = demisto.params().get("event_type") demisto.debug(f"The {event_type=}") max_results = arg_to_int(arg=demisto.params().get("max_fetch"), arg_name="max_fetch") if not max_results or max_results > MAX_INCIDENTS_TO_FETCH: max_results = MAX_INCIDENTS_TO_FETCH next_run, incidents = fetch_incidents( client=client, max_results=max_results, last_run=demisto.getLastRun(), first_fetch_time=first_fetch_time, as_user=as_user, event_type=event_type, ) demisto.setLastRun(next_run) demisto.incidents(incidents) elif demisto.command() == "box-create-file-share-link" or demisto.command() == "box-update-file-share-link": return_results(create_update_file_share_link_command(client=client, args=demisto.args())) elif demisto.command() == "box-remove-file-share-link": return_results(remove_file_share_link_command(client=client, args=demisto.args())) elif demisto.command() == "box-find-file-folder-by-share-link": return_results(find_file_folder_by_share_link_command(client=client, args=demisto.args())) elif demisto.command() == "box-get-shared-link-by-file": return_results(get_shared_link_for_file_command(client=client, args=demisto.args())) elif demisto.command() == "box-get-shared-link-by-folder": return_results(get_shared_link_by_folder_command(client=client, args=demisto.args())) elif demisto.command() == "box-create-folder-share-link" or demisto.command() == "box-update-folder-share-link": return_results(create_update_folder_share_link_command(client=client, args=demisto.args())) elif demisto.command() == "box-remove-folder-share-link": return_results(remove_folder_share_link_command(client=client, args=demisto.args())) elif demisto.command() == "box-get-folder": return_results(get_folder_command(client=client, args=demisto.args())) elif demisto.command() == "box-list-folder-items": return_results(list_folder_items_command(client=client, args=demisto.args())) elif demisto.command() == "box-folder-create": return_results(folder_create_command(client=client, args=demisto.args())) elif demisto.command() == "box-file-delete": return_results(file_delete_command(client=client, args=demisto.args())) elif demisto.command() == "box-list-users": return_results(list_users_command(client=client, args=demisto.args())) elif demisto.command() == "box-upload-file": return_results(upload_file_command(client=client, args=demisto.args())) elif demisto.command() == "box-trashed-items-list": return_results(trashed_items_list_command(client=client, args=demisto.args())) elif demisto.command() == "box-trashed-item-restore": return_results(trashed_item_restore_command(client=client, args=demisto.args())) elif demisto.command() == "box-trashed-item-delete-permanently": return_results(trashed_item_delete_permanently_command(client=client, args=demisto.args())) elif demisto.command() == "box-list-user-events": return_results(list_user_events_command(client=client, args=demisto.args())) elif demisto.command() == "box-list-enterprise-events": return_results(list_enterprise_events_command(client=client, args=demisto.args())) elif demisto.command() == "box-get-current-user": return_results(get_current_user_command(client=client, args=demisto.args())) elif demisto.command() == "box-create-user": return_results(create_user_command(client=client, args=demisto.args())) elif demisto.command() == "box-update-user": return_results(update_user_command(client=client, args=demisto.args())) elif demisto.command() == "box-delete-user": return_results(delete_user_command(client=client, args=demisto.args())) elif demisto.command() == "box-search-content": return_results(search_content_command(client=client, args=demisto.args())) elif demisto.command() == "box-move-folder": return_results(move_folder_command(client=client, args=demisto.args())) elif demisto.command() == "box-download-file": return_results( download_file_command( auth_params=demisto.params(), base_url=demisto_params.get("url", "https://api.box.com"), verify=verify_certificate, proxy=proxy, args=demisto.args(), ) ) else: raise NotImplementedError # Log exceptions and return errors except Exception as e: demisto.error(traceback.format_exc()) # print the traceback return_error(f"Failed to execute {demisto.command()} command.\nError:\n{str(e)}") """ ENTRY POINT """ if __name__ in ("__main__", "__builtin__", "builtins"): main()