All Projects → box → Box Java Sdk

box / Box Java Sdk

Licence: apache-2.0
The Box SDK for Java.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Box Java Sdk

Okteto
Develop your applications directly in your Kubernetes Cluster
Stars: ✭ 1,937 (+1487.7%)
Mutual labels:  hacktoberfest
Cluster.dev
Kubernetes-based Dev Environments with GitOps
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Pathlengthchecker
Path Length Checker is a stand-alone app that returns the paths and length of all files and directories in a given directory.
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Inav
INAV: Navigation-enabled flight control software
Stars: ✭ 1,830 (+1400%)
Mutual labels:  hacktoberfest
Aws Faq
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Fabric Gateway Java
Hyperledger Fabric Gateway SDK for Java https://wiki.hyperledger.org/display/fabric
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Puppet Mcollective
MCollective Server and Client Puppet Module
Stars: ✭ 121 (-0.82%)
Mutual labels:  hacktoberfest
Js Nightwatch Recorder
🌙 ⌚️ NightwatchJs recorder for Chrome
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Commandblocks
Mindustry Command Mod: A highly utilitarian mod with fun and useful blocks such as Command Blocks, Dash Panels and Pistons; New features such as Skills; And an upcoming new Gamemode!
Stars: ✭ 123 (+0.82%)
Mutual labels:  hacktoberfest
Patternlab Edition Node Webpack
The webpack wrapper around patternlab-node core, providing tasks to interact with the core library and move supporting frontend assets.
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Tobab
tobab: the poor mans identity aware proxy, easy to use setup for beyondcorp in your homelab
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Gamedev4noobs
Olá, sejam bem-vindos ao repositório _gamedev4noobs_ do Estúdio Vaca Roxa. O propósito desse repositório, além de contribuir para o projeto 4noobs, é ensinar o básico do desenvolvimento de jogos para iniciantes. Apresentando boas práticas e insumos para criar games incríveis.
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Https Localhost
HTTPS server running on localhost
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Defold
Defold is a completely free to use game engine for development of desktop, mobile and web games.
Stars: ✭ 1,938 (+1488.52%)
Mutual labels:  hacktoberfest
Ansible Openwisp2 Imagegenerator
Automatically build several openwisp2 firmware images for different organizations while keeping track of their differences
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Across Tabs
Easy communication between cross-origin browser tabs. Simplified "CORS"ing!
Stars: ✭ 1,575 (+1190.98%)
Mutual labels:  hacktoberfest
Shell completion
Write shell completion scripts in pure Rust
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Bitfield
🍰 bit field diagram renderer
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest
Vanessa Runner
утилита автоматизации базовых операций разработчика 1С
Stars: ✭ 120 (-1.64%)
Mutual labels:  hacktoberfest
Water Monitoring System
Water Monitoring System is an IOT based Liquid Level Monitoring system that has mechanisms to keep the user alerted in case of liquid overflow or when tank depletes.
Stars: ✭ 122 (+0%)
Mutual labels:  hacktoberfest

Project Status

Box Java SDK

The Box Java SDK for interacting with the Box Content API.

Quickstart

The SDK can be obtained by adding it as a maven dependency, cloning the source into your project, or by downloading one of the precompiled JARs from the releases page on GitHub.

IF YOU USE THE JAR, you'll also need to include several dependencies:

  1. minimal-json v0.9.1 Maven: com.eclipsesource.minimal-json:minimal-json:0.9.1
  2. jose4j v0.5.5 Maven: org.bitbucket.b_c:jose4j:0.5.5
  3. bouncycastle bcprov-jdk15on v1.60 Maven: org.bouncycastle:bcprov-jdk15on:1.60
  4. bouncycastle bcpkix-jdk15on v1.60 Maven: org.bouncycastle:bcpkix-jdk15on:1.60
  5. Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7 If you don't install this, you'll get an exception about key length or exception about parsing PKCS private key for Box Developer Edition. This is not a Box thing, this is a U.S. Government requirement concerning strong encryption. The listed jar is for Oracle JRE. There might be other similar JARs for different JRE versions like the one below for IBM JDK Java Cryptography Extension for IBM JDK

An app has to be authorized by the admin of the enterprise before these tests. It's always good to begin with the Getting Started Section at Box's developer website

Quick Test

Following things work only if the app has been configured and authorized as mentioned here

Here is a simple example of how to authenticate with the API using a developer token and then print the ID and name of each item in your root folder.

BoxAPIConnection api = new BoxAPIConnection("developer-token");
BoxFolder rootFolder = BoxFolder.getRootFolder(api);
for (BoxItem.Info itemInfo : rootFolder) {
    System.out.format("[%s] %s\n", itemInfo.getID(), itemInfo.getName());
}

For more details on how to get started, check out the overview guide. It has a short explanation of how the SDK works and how you can get started using it.

Sample Projects

Three sample projects can be found in src/example.

Main

This project will output your name and a list of the files and folders in your root directory.

To run the project, first provide a developer token in src/example/java/com/box/sdk/example/Main.java. You can obtain a developer token from your application's developer console.

public final class Main {
    private static final String DEVELOPER_TOKEN = "<YOUR_DEVELOPER_TOKEN>";

    // ...
}

Then just invoke gradle runExample to run the Main example!

Other projects

Below projects need app configurations stored in JSON format in config.json file at location src/example/config/.

This configuration file can be downloaded from your application's Configuration tab in the developer console

CreateAppUser

This project will output the user id of enterprise admin and will create a new App User for the enterprise.

To run the project, first provide the name of the app user in src/example/java/com/box/sdk/example/CreateAppUser.java.

public final class CreateAppUser {

    private static final String APP_USER_NAME = "";
    private static final String EXTERNAL_APP_USER_ID = "";

    // ...
}

Then just invoke gradle runCreateAppUser to run the CreateAppUser example!

Note: The JCE bundled with oracle JRE supports keys upto 128 bit length only. To use larger cryptographic keys, install JCE Unlimited Strength Jurisdiction Policy Files.

AccessAsAppUser

This project will retrieve the information of the given App User and will list the files/folders under root folder.

To run the project, first provide the Id of the app user in src/example/java/com/box/sdk/example/CreateAppUser.java.

public final class AccessAsAppUser {

    private static final String USER_ID = "";

    // ...
}

Then just invoke gradle runAccessAsAppUser to run the AccessAsAppUser example!

Note: The JCE bundled with oracle JRE supports keys upto 128 bit length only. To use larger cryptographic keys, install JCE Unlimited Strength Jurisdiction Policy Files.

BoxDeveloperEditionAPIConnectionAsEnterpriseUser

This example shows how to get tokens for an enterprise user, say admin of the enterprise and do actions on behalf of admin.

To run the project, follow below steps

  1. Turn on Enterprise in Application Access section in Developer Console for the app

  2. Turn on Generate User Access Tokens in Advanced Features section in Developer Console for the app

  3. Provide the Id of the admin user (or any enterprise user) in src/example/java/com/box/sdk/example/BoxDeveloperEditionAPIConnectionAsEnterpriseUser.java.

public final class BoxDeveloperEditionAPIConnectionAsEnterpriseUser {

    private static final String USER_ID = "";
    ...
    Reader reader = new FileReader("src/example/config/config.json");
    BoxConfig boxConfig = BoxConfig.readFrom(reader);

    api = new BoxDeveloperEditionAPIConnection(USER_ID, DeveloperEditionEntityType.USER, boxConfig,
        accessTokenCache);

Compatibility

The Box Java SDK is compatible with Java 7 and up.

Building

The SDK uses Gradle for its build system. Running gradle build from the root of the repository will compile, lint, and test the SDK.

$ gradle build

The SDK also includes integration tests which make real API calls, and therefore are run separately from unit tests. Integration tests should be run against a test account since they create and delete data. To run the integration tests, remove the .template extension from src/test/config/config.properties.template and fill in your test account's information. Then run:

$ gradle integrationTest

Documentation

You can find guides and tutorials in the doc directory.

Javadocs are generated when gradle javadoc is run and can be found in build/doc/javadoc.

Copyright and License

Copyright 2019 Box, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].