The Box Content Open With UI Element allows developers to embed a dropdown to open content stored in box with a partner application, or locally on the desktop. The Element fetches information about enabled integrations using the Box API, and calls out to partner services. Users can then take action in these services, and the edited content will be automatically saved back to Box. The integrations included in the Open With Element are Google Suite, and Box Edit. Additional information on the Google Suite integration can be found on the Box Community site. Currently, the element only supports for authentication.Documentation Index
Fetch the complete documentation index at: https://developer.box.com/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Box UI elements either through NPM or the Box CDN.Box Edit
Box Edit requires additional setup in order to be integrated into a platform application. Box Edit uses the desktop application Box Tools in order to open content locally.- Requests must use a secure connection (from an
httpsdomain) - The application’s domain must be allowed by Box Tools. Instructions can be found . The ideal workflow is to bundle these steps within an installer that also installs Box Tools.
- Safari requires a browser extension to connect to box tools. More details can be found here.
G Suite
A valid G Suite account is required in order to use the Box for G Suite integration. To connect a user’s G Suite and Box account, theexternal_app_user_id of the app user must be updated to be the email address
associated with the user’s G Suite account.
The external_app_user_id of an app user can be updated via the
endpoint.
Setup
The Open With UI Element is intended to be used after allowing your application and enabling integrations for app users using Box API endpoints.Activate application
The ‘Open With’ UI Element is available to any developer building with the Box Platform. To activate it for your instance, add the “Enable integrations” scope to your application in the developer console.
List available integrations
The first step to assigning an app integration to a user is to get the list of integrations that are available. ThisGET request can be made with the following
cURL request.
Get a specific integration
To obtain additional information about a specific integration, based on ID, the following GET request may be made.Add integration to user
To add an app integration to a valid app user, three pieces of information are required:- A valid Access Token.
- The ID of the app user to be assigned the integration
- The ID of the app integration to assign to the user
POST request can be made to assign an app integration to an app
user:
Remove integration from user
To remove an app integration from an app user, the following request may be made with a valid service access token and the app integration assignment ID from the previous step.Sample HTML
Demo
Open With Example
Content Explorer + Open With Example
Access TokenThese demos may not fully function until you provide a valid access token under
the JS tab of the demo. For the Open With element, you must provide a valid
Access Token.
Authentication
The UI Elements are designed in an authentication agnostic way so whether you are using UI Elements for users who have Box accounts (Managed Users) or non-Box accounts (App Users), UI Elements should work out of the box. The reason for this is that UI Elements only expect a “token” to be passed in for authentication, and Box provides two different ways to generate tokens - OAuth and JWT.Learn about selecting an authentication method
Scopes
To run integrations with downscoped tokens, you must include theitem_execute_integration scope as well as the scope required by the specific
integration you would like to use.
- Google:
item_readwriteon the parent folder - Adobe:
root_readwrite - Box Edit:
item_readwriteon the parent folder. - Box Edit Single File Collaboration:
item_readwriteon the file.
API
Parameters
| Parameter | Type | Description |
|---|---|---|
fileId | String | Box File ID. This will be the ID of the file for which you would like to execute integrations. |
accessToken | String | Box API access token to use. This should have read/write access to the folder above. The value passed in for the token is assumed to never expire while the explorer is visible. |
options | Object | Optional options. See below for details. For example: contentExplorer.show(FOLDER_ID, TOKEN, {canDelete: false}) would be used to hide the delete option. |
Options
| Parameter | Type | Description | |
|---|---|---|---|
dropdownAlignment | `left | right` | Determines the dropdown’s alignment to the open with button. The default is right. |
boxToolsName | String | This string will replace the name of Box Tools in the “Install Box Tools to open this file on your desktop” message. | |
boxToolsInstallUrl | String | This URL will be used instead of the default Box installation instructions which are linked in the “Install Box Tools to open this file on your desktop” message. | |
onExecute | Function | A callback that executes when an integration invocation is attempted. | |
onError | Function | A callback that executes when an error occurs. | |
requestInterceptor | Function | Function to intercept requests. For an example see . Our underlying XHR library is axios.js and we follow a . | |
responseInterceptor | Function | Function to intercept responses. For an example see . Our underlying XHR library is axios.js and we follow a . |
Events
| Event Name | Event Data | Description |
|---|---|---|
execute | Integration ID | Will be fired when an integration invocation is executed. |
error | Error | Will be fired when an error occurs. |
