Loading

Elastic Box connector reference

Th Box connector is written in Python using the Elastic connector framework.

View the source code for this connector (branch main, compatible with Elastic 9.0).

Important

As of Elastic 9.0, managed connectors on Elastic Cloud Hosted are no longer available. All connectors must be self-managed.

This connector is available as a self-managed connector. To use this connector, satisfy all self-managed connector prerequisites.

Note

This connector is in technical preview and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Technical preview features are not subject to the support SLA of official GA features.

To create a new Box connector:

  1. In the Kibana UI, navigate to the Search → Content → Connectors page from the main menu, or use the global search field.
  2. Follow the instructions to create a new Box self-managed connector.

You can use the Elasticsearch Create connector API to create a new self-managed Box self-managed connector.

For example:

 PUT _connector/my-box-connector {
  "index_name": "my-elasticsearch-index",
  "name": "Content synced from Box",
  "service_type": "box"
}

Refer to the Elasticsearch API documentation for details of all available Connector APIs.

To use this connector as a self-managed connector, use the Box tile from the connectors list OR Customized connector workflow.

For additional operations, see Connectors UI in Kibana.


Create Box User Authentication (OAuth 2.0) Custom App

You’ll need to create an OAuth app in the Box developer console by following these steps:

  1. Register a new app in the Box dev console with custom App and select User authentication (OAuth 2.0).
  2. Add the URL of the web page in Redirect URIs, which is accessible by you.
  3. Check "Write all files and folders stored in Box" in Application Scopes.
  4. Once the app is created, Client ID and Client secret values are available in the configuration tab. Keep these handy.


Generate a refresh Token

To generate a refresh token, follow these steps:

  1. Go to the following URL, replacing <CLIENT_ID> with the Client ID value saved earlier. For example:

    https://account.box.com/api/oauth2/authorize?response_type=code&client_id=<CLIENT_ID>
    
  2. Grant access to your application.

  3. You will now be redirected to the web page that you configured in Redirect URIs, and the HTTP response should contain an authorization code that you’ll use to generate a refresh token. Note: Authorization codes to generate refresh tokens can only be used once and are only valid for 30 seconds.

  4. In your terminal, run the following curl command, replacing <AUTHORIZATION_CODE>, <CLIENT_ID> and <CLIENT_SECRET> with the values you saved earlier:

    curl -i -X POST "https://api.box.com/oauth2/token" \
         -H "Content-Type: application/x-www-form-urlencoded" \
         -d "client_id=<CLIENT_ID>" \
         -d "client_secret=<CLIENT_SECRET>" \
         -d "code=<AUTHORIZATION_CODE>" \
         -d "grant_type=authorization_code"
    

    Save the refresh token from the response. You’ll need this for the connector configuration.


Create Box Server Authentication (Client Credentials Grant) Custom App

  1. Register a new app in the Box dev console with custom App and select Server Authentication (Client Credentials Grant).

  2. Check following permissions:

    • "Write all files and folders stored in Box" in Application Scopes
    • "Make API calls using the as-user header" in Advanced Features
  3. Select App + Enterprise Access in App Access Level.

  4. Authorize your application from the admin console. If you do not have permission, you may need to submit the application for authorization. Save the Client Credentials and Enterprise ID. You’ll need these to configure the connector.

Box Account (required)
Dropdown to determine Box Account type: Box Free Account or Box Enterprise Account. Default value is Box Free Account.
Client ID (required)
The Client ID to authenticate with Box instance.
Client Secret (required)
The Client Secret to authenticate with Box instance.
Refresh Token (required if Box Account is Box Free)
The Refresh Token to generate Access Token. NOTE: If the process terminates, you’ll need to generate a new refresh token.
Enterprise ID (required if Box Account is Box Enterprise)
The Enterprise ID to authenticate with Box instance.

You can deploy the Box connector as a self-managed connector using Docker. Follow these instructions.

Refer to DOCKER.md in the elastic/connectors repo for more details.

Find all available Docker images in the official registry.

Tip

We also have a quickstart self-managed option using Docker Compose, so you can spin up all required services at once: Elasticsearch, Kibana, and the connectors service. Refer to this README in the elastic/connectors repo for more information.

Refer to Content extraction.

The connector syncs the following objects and entities:

  • Files
  • Folders
Note
  • Files bigger than 10 MB won’t be extracted.
  • Permissions are not synced. All documents indexed to an Elastic deployment will be visible to all users with access to that Elastic Deployment.

Full syncs are supported by default for all connectors.

This connector also supports incremental syncs.

Basic sync rules are identical for all connectors and are available by default.

Advanced sync rules are not available for this connector in the present version.

The connector framework enables operators to run functional tests against a real data source. Refer to Connector testing for more details.

To perform E2E testing for the Box connector, run the following command:

$ make ftest NAME=box

For faster tests, add the DATA_SIZE=small flag:

make ftest NAME=box DATA_SIZE=small

There are no known issues for this connector. Refer to Known issues for a list of known issues for all connectors.

See Troubleshooting.

See Security.