SDKs overview

The Box API offers Software Development Kits (SDKs) to facilitate integration with its cloud content management platform. These SDKs are designed to simplify interactions with the Box API by providing idiomatic interfaces for various programming languages and platforms. Developers can use these tools to programmatically manage files, folders, users, and collaborate features, reducing the need to handle raw HTTP requests and JSON parsing directly. The SDKs abstract common API tasks, allowing developers to focus on application logic rather than the intricacies of the underlying RESTful API.

Box provides officially supported SDKs for popular languages and mobile platforms, ensuring compatibility and ongoing maintenance. In addition to official offerings, the Box developer community contributes various libraries and tools, extending the ecosystem and supporting specialized use cases. All interactions with the Box API, whether through SDKs or direct calls, rely on OAuth 2.0 for authentication and authorization, ensuring secure access to user data and resources.

Official SDKs by language

Box maintains official SDKs for several programming languages and mobile platforms. These SDKs are developed and supported by Box, ensuring they are kept up-to-date with the latest API versions and features. They typically include methods for common operations such as uploading and downloading files, managing folder structures, handling user permissions, and interacting with Box Sign or Box Notes functionalities programmatically. The official SDKs are the recommended approach for most integrations due to their reliability, comprehensive feature coverage, and direct support from Box.

The following table outlines the official SDKs available, their respective package names, and typical installation commands:

Language/Platform Package Name Installation Command Maturity
Node.js box-node-sdk npm install box-node-sdk Stable
Python boxsdk pip install boxsdk Stable
Java box-java-sdk Maven: Add dependency to pom.xml Stable
.NET Box.V2 Install-Package Box.V2 Stable
iOS BoxContentSDK CocoaPods: Add to Podfile Stable
Android box-android-sdk Gradle: Add dependency to build.gradle Stable

Installation

Installing a Box SDK typically involves using the package manager specific to the programming language or platform. Below are general instructions for each officially supported SDK. For detailed, up-to-date instructions, developers should always refer to the official Box API documentation.

Node.js

To install the Node.js SDK, use npm (Node Package Manager) or yarn:

npm install box-node-sdk
# or
yarn add box-node-sdk

Python

The Python SDK can be installed using pip:

pip install boxsdk

Java

For Java projects, the SDK is typically managed with Maven or Gradle. For Maven, add the following dependency to your pom.xml file:

<dependency>
    <groupId>com.box</groupId>
    <artifactId>box-java-sdk</artifactId>
    <version>LATEST_VERSION</version>
</dependency>

Replace LATEST_VERSION with the most recent stable version, which can be found in the official Box Java SDK documentation.

.NET

The .NET SDK is available via NuGet. Use the Package Manager Console in Visual Studio:

Install-Package Box.V2

iOS

For iOS development, CocoaPods is the recommended way to integrate the Box Content SDK. Add the following to your Podfile:

pod 'BoxContentSDK'

Then run pod install.

Android

For Android projects, add the SDK as a dependency in your app's build.gradle file:

dependencies {
    implementation 'com.box:box-android-sdk:LATEST_VERSION'
}

Replace LATEST_VERSION with the most recent stable version, which can be found in the official Box Android SDK documentation.

Quickstart example

This example demonstrates how to authenticate and list the items in the root folder of a Box account using the Node.js SDK. This quickstart assumes you have an OAuth 2.0 access token. For production applications, Box recommends using server-side authentication methods like JWT or Client Credentials Grant for secure token management.

Node.js Quickstart: List Root Folder Contents

const BoxSDK = require('box-node-sdk');

// Replace with your actual developer token or obtain via OAuth 2.0 flow
const DEVELOPER_TOKEN = 'YOUR_DEVELOPER_TOKEN'; 

// Initialize the SDK with your developer token
const sdk = new BoxSDK({
    clientID: 'YOUR_CLIENT_ID', // Required but not used for developer token auth
    clientSecret: 'YOUR_CLIENT_SECRET' // Required but not used for developer token auth
});

const client = sdk.get = sdk.getDeveloperClient(DEVELOPER_TOKEN);

async function listRootFolderItems() {
    try {
        // Get information about the root folder (ID '0')
        const rootFolder = await client.folders.get('0');
        console.log(`Root Folder Name: ${rootFolder.name}`);

        // Get items in the root folder
        const items = await client.folders.getItems('0');
        console.log('Items in Root Folder:');
        items.entries.forEach(item => {
            console.log(`- ${item.type}: ${item.name} (ID: ${item.id})`);
        });

    } catch (error) {
        console.error('Error listing root folder items:', error.message);
        // More detailed error logging for debugging
        if (error.response && error.response.data) {
            console.error('API Error Response:', error.response.data);
        }
    }
}

listRootFolderItems();

This snippet initializes the Box SDK with a developer token and then calls the folders.get and folders.getItems methods to retrieve and display information about the root folder and its contents. For a complete guide on acquiring and managing access tokens, consult the Box API authentication documentation.

Community libraries

Beyond the officially supported SDKs, the Box developer community contributes a range of libraries and tools that can enhance or extend Box API integrations. These community-driven projects often cater to specific use cases, provide bindings for additional programming languages, or offer utilities that complement the official SDKs. While not officially supported by Box, these libraries can be valuable resources for developers looking for alternative implementations or specialized functionalities.

Examples of community contributions might include:

  • Third-party wrappers for less common languages: Developers might create SDKs for languages not officially supported by Box, enabling a broader range of applications to integrate with the Box API.
  • Specialized tools for specific workflows: Libraries could focus on niche aspects, such as enhanced file preview generation, advanced metadata management, or custom webhook handlers.
  • Integrations with other platforms: Community projects sometimes provide bridges between Box and other popular services or frameworks, streamlining complex multi-platform solutions.

When considering community libraries, it is advisable to evaluate their maintenance status, community activity, and compatibility with the latest Box API versions. Resources like GitHub and developer forums are good places to discover and assess these contributions. The Box developer portal often highlights community projects or provides links to relevant repositories, fostering collaboration and shared development efforts within the ecosystem. Always review the source code and licensing of any third-party library before incorporating it into a production environment.