Box
Since Camel 2.14
Both producer and consumer are supported
The Box component provides access to all the Box.com APIs accessible using Box Java SDK. It allows producing messages to upload and download files, create, edit, and manage folders, etc. It also supports APIs that allow polling for updates to user accounts and even changes to enterprise accounts, etc.
Box.com requires the use of OAuth2.0 for all client application authentications. To use camel-box with your account, you’ll need to create a new application within Box.com at https://developer.box.com. The Box application’s client id and secret will allow access to Box APIs which require a current user. A user access token is generated and managed by the API for an end user.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-box</artifactId>
<version>${camel-version}</version>
</dependency> Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Box component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The client ID of the Box application. | String | ||
To use the shared configuration. | BoxConfiguration | ||
The ID of the Box enterprise whose service account the component connects as, for APP_ENTERPRISE_AUTHENTICATION. | String | ||
The ID of the app user that the component connects as, for APP_USER_AUTHENTICATION. | String | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The proxy of STANDARD_AUTHENTICATION: the entry http.route.default-proxy (an HttpHost of Apache HttpComponents 5) is the proxy of the requests to the Box login page, and the entry http.route.socks-proxy set to true makes it a SOCKS proxy. The calls to the Box API do not use this proxy. | Map | ||
How the component authenticates to Box: APP_USER_AUTHENTICATION (OAuth 2.0 with a JWT assertion, as the app user of userId), APP_ENTERPRISE_AUTHENTICATION (OAuth 2.0 with a JWT assertion, as the service account of the enterprise of enterpriseId) or STANDARD_AUTHENTICATION (OAuth 2.0 with an authorization code, which the component gets by logging in to Box with userName and userPassword; it fails when the account uses 2-step verification). | APP_USER_AUTHENTICATION | String | |
The cache of the access tokens of APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. When not set, an in-memory LRU cache with maxCacheEntries entries is used. | IAccessTokenCache | ||
The client secret of the Box application. | String | ||
The algorithm that signs the JWT assertion of APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. Enum values:
| RSA_SHA_256 | EncryptionAlgorithm | |
The maximum number of access tokens in the in-memory cache that is used when accessTokenCache is not set. | 100 | int | |
The path of the file with the PEM encoded private key that signs the JWT assertion, for APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. | String | ||
The password that decrypts the private key of privateKeyFile. | String | ||
The ID of the public key that Box uses to verify the signature of the JWT assertion, for APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. | String | ||
To configure security using SSLContextParameters. | SSLContextParameters | ||
The login (email address) of the Box user, which the component enters in the Box login form for STANDARD_AUTHENTICATION. | String | ||
The password of the Box user, which the component enters in the Box login form for STANDARD_AUTHENTICATION. | String |
Endpoint Options
The Box endpoint is configured using URI syntax:
box:apiName/methodName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The Box API to use: collaborations, comments, event-logs, events, files, folders, groups, search, tasks or users. Enum values:
| BoxApiName | ||
Required The method of the API to call, such as uploadFile of the files API. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The client ID of the Box application. | String | ||
The ID of the Box enterprise whose service account the component connects as, for APP_ENTERPRISE_AUTHENTICATION. | String | ||
Sets the name of a parameter to be passed in the exchange In Body. | String | ||
The ID of the app user that the component connects as, for APP_USER_AUTHENTICATION. | String | ||
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The proxy of STANDARD_AUTHENTICATION: the entry http.route.default-proxy (an HttpHost of Apache HttpComponents 5) is the proxy of the requests to the Box login page, and the entry http.route.socks-proxy set to true makes it a SOCKS proxy. The calls to the Box API do not use this proxy. | Map | ||
How the component authenticates to Box: APP_USER_AUTHENTICATION (OAuth 2.0 with a JWT assertion, as the app user of userId), APP_ENTERPRISE_AUTHENTICATION (OAuth 2.0 with a JWT assertion, as the service account of the enterprise of enterpriseId) or STANDARD_AUTHENTICATION (OAuth 2.0 with an authorization code, which the component gets by logging in to Box with userName and userPassword; it fails when the account uses 2-step verification). | APP_USER_AUTHENTICATION | String | |
The cache of the access tokens of APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. When not set, an in-memory LRU cache with maxCacheEntries entries is used. | IAccessTokenCache | ||
The client secret of the Box application. | String | ||
The algorithm that signs the JWT assertion of APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. Enum values:
| RSA_SHA_256 | EncryptionAlgorithm | |
The maximum number of access tokens in the in-memory cache that is used when accessTokenCache is not set. | 100 | int | |
The path of the file with the PEM encoded private key that signs the JWT assertion, for APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. | String | ||
The password that decrypts the private key of privateKeyFile. | String | ||
The ID of the public key that Box uses to verify the signature of the JWT assertion, for APP_USER_AUTHENTICATION and APP_ENTERPRISE_AUTHENTICATION. | String | ||
To configure security using SSLContextParameters. | SSLContextParameters | ||
The login (email address) of the Box user, which the component enters in the Box login form for STANDARD_AUTHENTICATION. | String | ||
The password of the Box user, which the component enters in the Box login form for STANDARD_AUTHENTICATION. | String |
API Parameters (10 APIs)
The Box endpoint is an API-based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:
box:apiName/methodName
There are 10 API names as listed in the table below:
| API Name | Type | Description |
|---|---|---|
Producer | Provides operations to manage Box collaborations | |
Producer | Provides operations to manage Box comments | |
Producer | Provides operations to read Box enterprise (admin) event logs | |
Consumer | Provides the consumer that receives the events of the event stream of the Box user | |
Producer | Provides operations to manage Box files | |
Producer | Provides operations to manage Box folders | |
Producer | Provides operations to manage Box groups | |
Producer | Provides operations to manage Box searches | |
Producer | Provides operations to manage Box tasks | |
Producer | Provides operations to manage Box users |
Each API is documented in the following sections to come.
API: collaborations
Only producer is supported
The collaborations API is defined in the syntax as follows:
box:collaborations/methodName?[parameters] The 7 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
add | Add a user or a group as collaborator of a folder, with the given role | |
add | Add the user with the given email address as collaborator of a folder, with the given role | |
delete | Delete collaboration | |
info | Get collaboration information | |
collaborations | Get information about all of the collaborations for folder | |
pendingCollaborations | Get all pending collaboration invites for the current user | |
updateInfo | Update collaboration information |
Method addFolderCollaboration
Signatures:
-
com.box.sdk.BoxCollaboration addFolderCollaboration(String folderId, com.box.sdk.BoxCollaborator collaborator, com.box.sdk.BoxCollaboration.Role role);
The box/addFolderCollaboration API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
collaborator | The collaborator to add: a BoxUser or a BoxGroup. | BoxCollaborator |
folderId | The id of folder to add collaboration to | String |
role | The role of the collaborator, such as EDITOR, VIEWER, UPLOADER or CO_OWNER. | Role |
Method addFolderCollaborationByEmail
Signatures:
-
com.box.sdk.BoxCollaboration addFolderCollaborationByEmail(String folderId, String email, com.box.sdk.BoxCollaboration.Role role);
The box/addFolderCollaborationByEmail API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
The email address of the collaborator to add | String | |
folderId | The id of folder to add collaboration to | String |
role | The role of the collaborator, such as EDITOR, VIEWER, UPLOADER or CO_OWNER. | Role |
Method deleteCollaboration
Signatures:
-
void deleteCollaboration(String collaborationId);
The box/deleteCollaboration API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
collaborationId | The id of the collaboration to delete | String |
Method getCollaborationInfo
Signatures:
-
com.box.sdk.BoxCollaboration.Info getCollaborationInfo(String collaborationId);
The box/getCollaborationInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
collaborationId | The id of collaboration | String |
Method getFolderCollaborations
Signatures:
-
java.util.Collection<com.box.sdk.BoxCollaboration.Info> getFolderCollaborations(String folderId);
The box/getFolderCollaborations API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderId | The id of folder to get collaborations information on | String |
Method getPendingCollaborations
Signatures:
-
java.util.Collection<com.box.sdk.BoxCollaboration.Info> getPendingCollaborations();
The box/getPendingCollaborations API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|
Method updateCollaborationInfo
Signatures:
-
com.box.sdk.BoxCollaboration updateCollaborationInfo(String collaborationId, com.box.sdk.BoxCollaboration.Info info);
The box/updateCollaborationInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
collaborationId | The id of collaboration | String |
info | Collaboration information to update | Info |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: comments
Only producer is supported
The comments API is defined in the syntax as follows:
box:comments/methodName?[parameters] The 6 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
add | Add comment to file | |
updateMessage | Change comment message | |
delete | Delete comment | |
info | Get comment information | |
comments | Get a list of any comments on this file | |
reply | Reply to a comment |
Method addFileComment
Signatures:
-
com.box.sdk.BoxFile addFileComment(String fileId, String message);
The box/addFileComment API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
message | The comment’s message | String |
Method changeCommentMessage
Signatures:
-
com.box.sdk.BoxComment changeCommentMessage(String commentId, String message);
The box/changeCommentMessage API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
commentId | The id of comment to change | String |
message | The new message for the comment | String |
Method deleteComment
Signatures:
-
void deleteComment(String commentId);
The box/deleteComment API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
commentId | The id of comment to delete | String |
Method getCommentInfo
Signatures:
-
com.box.sdk.BoxComment.Info getCommentInfo(String commentId);
The box/getCommentInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
commentId | The id of comment | String |
Method getFileComments
Signatures:
-
java.util.List<com.box.sdk.BoxComment.Info> getFileComments(String fileId);
The box/getFileComments API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
Method replyToComment
Signatures:
-
com.box.sdk.BoxComment replyToComment(String commentId, String message);
The box/replyToComment API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
commentId | The id of comment to reply to | String |
message | The message for the reply | String |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: event-logs
Only producer is supported
The event-logs API is defined in the syntax as follows:
box:event-logs/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
events | Get the enterprise events created between the after and before dates, optionally of the given event types and from a stream position |
Method getEnterpriseEvents
Signatures:
-
java.util.List<com.box.sdk.BoxEvent> getEnterpriseEvents(String position, java.util.Date after, java.util.Date before, com.box.sdk.BoxEvent.EventType[] types);
The box/getEnterpriseEvents API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
after | The date and time after which the events were created; required. | Date |
before | The date and time before which the events were created; required. | Date |
position | The stream position to start reading at, such as the next stream position of an earlier read, or null to read all the events between after and before. | String |
types | The event types to return, or null to return the events of all types. | EventType[] |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: events
Only consumer is supported
The events API is defined in the syntax as follows:
box:events/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Receive the events of the event stream of the Box user, from the given stream position or from now on |
Method listen
Signatures:
-
void listen(com.box.sdk.EventListener listener, Long startingPosition);
The box/listen API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
startingPosition | The stream position to start at; when null or -1, only the events from now on are received. | Long |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: files
Only producer is supported
The files API is defined in the syntax as follows:
box:files/methodName?[parameters] The 21 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
canUpload | Does a preflight check before an upload, to check if the file name is already used in the parent folder or the file cannot be uploaded there for another reason, such as a missing permission | |
copy | Copy file to destination folder while optionally giving it a new name | |
createMetadata | Create metadata for file in either the global properties template or the specified template type | |
link | Create a shared link to file | |
delete | Delete the file | |
delete | Delete the metadata of the properties template of a file | |
delete | Delete a file version | |
download | Download a file | |
downloadVersion | Download a previous version of file | |
url | Get an expiring URL for downloading a file directly from Box | |
info | Get file information | |
metadata | Gets the metadata of a file, of the properties template or of the given template | |
Get an expiring URL for creating an embedded preview session | ||
versions | Get any previous versions of file | |
move | Move file to destination folder while optionally giving it a new name | |
promoteVersion | Promote a previous version of file | |
rename | Rename file giving it the name newName | |
updateInfo | Update file information | |
updateMetadata | Update the metadata of a file, of the template that the metadata names | |
upload | Upload a new file to parent folder | |
uploadVersion | Upload a new version of file |
Method checkUpload
Signatures:
-
void checkUpload(String fileName, String parentFolderId, Long size);
The box/checkUpload API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileName | The name to give the uploaded file | String |
parentFolderId | The id of parent folder | String |
size | The size of the file in bytes, which Box checks against the limits of the account; required. | Long |
Method copyFile
Signatures:
-
com.box.sdk.BoxFile copyFile(String fileId, String destinationFolderId, String newName);
The box/copyFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
destinationFolderId | The id of the destination folder | String |
fileId | The id of file to copy | String |
newName | The new name for copied file; if newName is null, the copied file has same name as the original. | String |
Method createFileMetadata
Signatures:
-
com.box.sdk.Metadata createFileMetadata(String fileId, com.box.sdk.Metadata metadata, String typeName);
The box/createFileMetadata API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of the file to create metadata for | String |
metadata | The new metadata values | Metadata |
typeName | The name of the metadata template; if null the properties template of the global scope is used. Any other template is one of the enterprise scope. | String |
Method createFileSharedLink
Signatures:
-
com.box.sdk.BoxSharedLink createFileSharedLink(String fileId, com.box.sdk.BoxSharedLink.Access access, java.util.Date unshareDate, com.box.sdk.BoxSharedLink.Permissions permissions);
The box/createFileSharedLink API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
access | The access level of the shared link: DEFAULT, OPEN, COMPANY or COLLABORATORS. | Access |
fileId | The id of the file to create shared link on | String |
permissions | The permissions of the shared link: whether it allows to download, preview and edit the file; the method fails when it is not set. | Permissions |
unshareDate | The date and time at which the shared link expires; the method fails when it is not set. | Date |
Method deleteFile
Signatures:
-
void deleteFile(String fileId);
The box/deleteFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file to delete | String |
Method deleteFileMetadata
Signatures:
-
void deleteFileMetadata(String fileId);
The box/deleteFileMetadata API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of the file to delete the metadata of | String |
Method deleteFileVersion
Signatures:
-
void deleteFileVersion(String fileId, Integer version);
The box/deleteFileVersion API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file with version to delete | String |
version | The version to delete: its index, starting at 0, in the list of previous versions of the file that getFileVersions returns. | Integer |
Method downloadFile
Signatures:
-
java.io.OutputStream downloadFile(String fileId, java.io.OutputStream output, Long rangeStart, Long rangeEnd, com.box.sdk.ProgressListener listener);
The box/downloadFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
listener | A listener for monitoring the download’s progress; if null the download’s progress will not be monitored. | ProgressListener |
output | The OutputStream that the content of the file is written to; the method returns it. | OutputStream |
rangeEnd | The byte offset in file at which to stop the download, inclusive, or 0 to download to the end of the file; used only together with rangeStart, else the entire contents of file will be downloaded. | Long |
rangeStart | The byte offset in file at which to start the download; used only together with rangeEnd, else the entire contents of file will be downloaded. | Long |
Method downloadPreviousFileVersion
Signatures:
-
java.io.OutputStream downloadPreviousFileVersion(String fileId, Integer version, java.io.OutputStream output, com.box.sdk.ProgressListener listener);
The box/downloadPreviousFileVersion API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
listener | A listener for monitoring the download’s progress; if null the download’s progress will not be monitored. | ProgressListener |
output | The OutputStream that the content of the version is written to; the method returns it. | OutputStream |
version | The version to download: its index, starting at 0, in the list of previous versions of the file that getFileVersions returns. | Integer |
Method getDownloadURL
Signatures:
-
java.net.URL getDownloadURL(String fileId);
The box/getDownloadURL API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
Method getFileInfo
Signatures:
-
com.box.sdk.BoxFile.Info getFileInfo(String fileId, String[] fields);
The box/getFileInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fields | The information fields to retrieve, such as name or size; if null the standard fields are retrieved. | String[] |
fileId | The id of file | String |
Method getFileMetadata
Signatures:
-
com.box.sdk.Metadata getFileMetadata(String fileId, String typeName);
The box/getFileMetadata API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of the file to retrieve metadata for | String |
typeName | The name of the metadata template; if null the properties template of the global scope is used. Any other template is one of the enterprise scope. | String |
Method getFilePreviewLink
Signatures:
-
java.net.URL getFilePreviewLink(String fileId);
The box/getFilePreviewLink API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of the file to get preview link on | String |
Method getFileVersions
Signatures:
-
java.util.Collection<com.box.sdk.BoxFileVersion> getFileVersions(String fileId);
The box/getFileVersions API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
Method moveFile
Signatures:
-
com.box.sdk.BoxFile moveFile(String fileId, String destinationFolderId, String newName);
The box/moveFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
destinationFolderId | The id of the destination folder | String |
fileId | The id of file to move | String |
newName | The new name of moved file; if newName is null, the moved file has same name as the original. | String |
Method promoteFileVersion
Signatures:
-
com.box.sdk.BoxFileVersion promoteFileVersion(String fileId, Integer version);
The box/promoteFileVersion API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
version | The version to promote: its index, starting at 0, in the list of previous versions of the file that getFileVersions returns. | Integer |
Method renameFile
Signatures:
-
com.box.sdk.BoxFile renameFile(String fileId, String newFileName);
The box/renameFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file to rename | String |
newFileName | The new name of file | String |
Method updateFileInfo
Signatures:
-
com.box.sdk.BoxFile updateFileInfo(String fileId, com.box.sdk.BoxFile.Info info);
The box/updateFileInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file to update | String |
info | The updated information | Info |
Method updateFileMetadata
Signatures:
-
com.box.sdk.Metadata updateFileMetadata(String fileId, com.box.sdk.Metadata metadata);
The box/updateFileMetadata API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of the file to update the metadata of | String |
metadata | The metadata to update: its template and the add, replace and remove operations made on it. | Metadata |
Method uploadFile
Signatures:
-
com.box.sdk.BoxFile uploadFile(String parentFolderId, java.io.InputStream content, String fileName, java.util.Date created, java.util.Date modified, Long size, Boolean check, com.box.sdk.ProgressListener listener);
The box/uploadFile API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
check | Whether to check first if a file named fileName exists in the parent folder and, if so, upload the content as a new version of that file. | Boolean |
content | A stream containing contents of the file to upload | InputStream |
created | The content created date that will be given to the uploaded file | Date |
fileName | The name to give the uploaded file | String |
listener | A ProgressListener that is told the progress of the upload | ProgressListener |
modified | The content modified date that will be given to the uploaded file | Date |
parentFolderId | The id of parent folder | String |
size | The size of the content in bytes; when set, it is sent as the length of the content, so it must be exact, and it is used to report the progress to the listener. | Long |
Method uploadNewFileVersion
Signatures:
-
com.box.sdk.BoxFile uploadNewFileVersion(String fileId, java.io.InputStream fileContent, java.util.Date modified, Long fileSize, com.box.sdk.ProgressListener listener);
The box/uploadNewFileVersion API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileContent | A stream containing contents of the file to upload | InputStream |
fileId | The id of the file to upload a new version of | String |
fileSize | The size of the content in bytes, sent as the length of the content and used to report the progress to the listener; used only when modified is set. | Long |
listener | A ProgressListener that is told the progress of the upload; used only when modified is set. | ProgressListener |
modified | The content modified date that will be given to the new version; fileSize and listener are used only when it is set. | Date |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: folders
Only producer is supported
The folders API is defined in the syntax as follows:
box:folders/methodName?[parameters] The 11 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
copy | Copy folder to destination folder while optionally giving it a new name | |
create | Create a folder specified by path from parent folder with given parentFolderId, creating intermediate directories as required | |
create | Create a shared link to folder | |
delete | Delete folder and all its content | |
folder | Return the Box folder referenced by path | |
folder | Get folder information | |
folder | Returns a specific range of child items in folder and specifies which fields of each item to retrieve | |
root | Return the root folder of authenticated user | |
move | Move folder to destination folder while optionally giving it a new name | |
rename | Rename folder giving it the name newName | |
updateInfo | Update folder information |
Method copyFolder
Signatures:
-
com.box.sdk.BoxFolder copyFolder(String folderId, String destinationFolderId, String newName);
The box/copyFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
destinationFolderId | The id of the destination folder | String |
folderId | The id of folder to copy | String |
newName | The new name for copied folder; if newName is null, the copied folder has same name as the original. | String |
Method createFolder
Signatures:
-
com.box.sdk.BoxFolder createFolder(String parentFolderId, String folderName);
-
com.box.sdk.BoxFolder createFolder(String parentFolderId, String[] path);
The box/createFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderName | The name of created folder | String |
parentFolderId | The id of parent folder | String |
path | Sequence of Box folder names from parent folder to returned folder; the folders that do not exist yet are created. | String[] |
Method createFolderSharedLink
Signatures:
-
com.box.sdk.BoxSharedLink createFolderSharedLink(String folderId, com.box.sdk.BoxSharedLink.Access access, java.util.Date unshareDate, com.box.sdk.BoxSharedLink.Permissions permissions);
The box/createFolderSharedLink API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
access | The access level of the shared link: DEFAULT, OPEN, COMPANY or COLLABORATORS. | Access |
folderId | The id of folder to create shared link on | String |
permissions | The permissions of the shared link: whether it allows to download and preview the files; the method fails when it is not set. | Permissions |
unshareDate | The date and time at which the shared link expires; the method fails when it is not set. | Date |
Method deleteFolder
Signatures:
-
void deleteFolder(String folderId);
The box/deleteFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderId | The id of folder to delete | String |
Method getFolder
Signatures:
-
com.box.sdk.BoxFolder getFolder(String[] path);
The box/getFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
path | Sequence of Box folder names from root folder to returned folder; if null or empty, the root folder is returned. | String[] |
Method getFolderInfo
Signatures:
-
com.box.sdk.BoxFolder.Info getFolderInfo(String folderId, String[] fields);
The box/getFolderInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fields | The information fields to retrieve, such as name or size; if null the standard fields are retrieved. | String[] |
folderId | The id of folder | String |
Method getFolderItems
Signatures:
-
java.util.Collection<com.box.sdk.BoxItem.Info> getFolderItems(String folderId, Long offset, Long limit, String[] fields);
The box/getFolderItems API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fields | The item fields to retrieve for each child item; if null the standard fields are retrieved. | String[] |
folderId | The id of folder | String |
limit | The maximum number of children to retrieve after the offset; used only together with offset, else all child items are retrieved. | Long |
offset | The index of first child item to retrieve; used only together with limit, else all child items are retrieved. | Long |
Method getRootFolder
Signatures:
-
com.box.sdk.BoxFolder getRootFolder();
The box/getRootFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|
Method moveFolder
Signatures:
-
com.box.sdk.BoxFolder moveFolder(String folderId, String destinationFolderId, String newName);
The box/moveFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
destinationFolderId | The id of the destination folder | String |
folderId | The id of folder to move | String |
newName | The new name of moved folder; if newName is null, the moved folder has same name as the original. | String |
Method renameFolder
Signatures:
-
com.box.sdk.BoxFolder renameFolder(String folderId, String newFolderName);
The box/renameFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderId | The id of folder to rename | String |
newFolderName | The new name of folder | String |
Method updateFolderInfo
Signatures:
-
com.box.sdk.BoxFolder updateFolderInfo(String folderId, com.box.sdk.BoxFolder.Info info);
The box/updateFolderInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderId | The id of folder to update | String |
info | The updated information | Info |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: groups
Only producer is supported
The groups API is defined in the syntax as follows:
box:groups/methodName?[parameters] The 10 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
addMembership | Add a member to group with the specified role | |
create | Create a new group with a specified name and optional additional parameters | |
delete | Delete group | |
delete | Delete group membership | |
groups | Get all the groups in the enterprise | |
info | Get group information | |
membershipInfo | Get group membership information | |
memberships | Get information about all of the group memberships for this group | |
Update group information | ||
updateMembershipInfo | Update group membership information |
Method addGroupMembership
Signatures:
-
com.box.sdk.BoxGroupMembership addGroupMembership(String groupId, String userId, com.box.sdk.BoxGroupMembership.GroupRole role);
The box/addGroupMembership API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupId | The id of group | String |
role | The role of the user in this group: ADMIN or MEMBER. Can be null to assign the default role. | GroupRole |
userId | The id of user to be added to group | String |
Method createGroup
Signatures:
-
com.box.sdk.BoxGroup createGroup(String name, String provenance, String externalSyncIdentifier, String description, String invitabilityLevel, String memberViewabilityLevel);
The box/createGroup API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
description | The description of the new group | String |
externalSyncIdentifier | The id of the group in the external system that it is synchronized with | String |
invitabilityLevel | Who can invite the group to collaborate on folders: admins_only, admins_and_members or all_managed_users. | String |
memberViewabilityLevel | Who can see the members of the group: admins_only, admins_and_members or all_managed_users. | String |
name | The name of the new group | String |
provenance | The provenance of the new group: the external system that the group comes from, such as Active Directory. | String |
Method deleteGroup
Signatures:
-
void deleteGroup(String groupId);
The box/deleteGroup API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupId | The id of group to delete | String |
Method deleteGroupMembership
Signatures:
-
void deleteGroupMembership(String groupMembershipId);
The box/deleteGroupMembership API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupMembershipId | The id of group membership to delete | String |
Method getAllGroups
Signatures:
-
java.util.Collection<com.box.sdk.BoxGroup> getAllGroups();
The box/getAllGroups API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|
Method getGroupInfo
Signatures:
-
com.box.sdk.BoxGroup.Info getGroupInfo(String groupId);
The box/getGroupInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupId | The id of group | String |
Method getGroupMembershipInfo
Signatures:
-
com.box.sdk.BoxGroupMembership.Info getGroupMembershipInfo(String groupMembershipId);
The box/getGroupMembershipInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupMembershipId | The id of group membership | String |
Method getGroupMemberships
Signatures:
-
java.util.Collection<com.box.sdk.BoxGroupMembership.Info> getGroupMemberships(String groupId);
The box/getGroupMemberships API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupId | The id of group | String |
Method updateGroupInfo
Signatures:
-
com.box.sdk.BoxGroup updateGroupInfo(String groupId, com.box.sdk.BoxGroup.Info groupInfo);
The box/updateGroupInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupId | The id of group to update | String |
groupInfo | The updated information | Info |
Method updateGroupMembershipInfo
Signatures:
-
com.box.sdk.BoxGroupMembership updateGroupMembershipInfo(String groupMembershipId, com.box.sdk.BoxGroupMembership.Info info);
The box/updateGroupMembershipInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
groupMembershipId | The id of group membership to update | String |
info | The updated information | Info |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: search
Only producer is supported
The search API is defined in the syntax as follows:
box:search/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
search | Search folder and all descendant folders using the given query |
Method searchFolder
Signatures:
-
java.util.Collection<com.box.sdk.BoxItem> searchFolder(String folderId, String query);
The box/searchFolder API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
folderId | The id of the folder to search in, together with all its subfolders. | String |
query | The search query | String |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: tasks
Only producer is supported
The tasks API is defined in the syntax as follows:
box:tasks/methodName?[parameters] The 9 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
addAssignment | Add assignment for task | |
add | Add task to file | |
delete | Delete task | |
delete | Delete task assignment | |
tasks | Get a list of any tasks on file | |
assignmentInfo | Get task assignment information | |
assignments | Get a list of any assignments for task | |
info | Get task information | |
updateInfo | Update task information |
Method addAssignmentToTask
Signatures:
-
com.box.sdk.BoxTask addAssignmentToTask(String taskId, com.box.sdk.BoxUser assignTo);
The box/addAssignmentToTask API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
assignTo | The user to assign the task to | BoxUser |
taskId | The id of task to add assignment for | String |
Method addFileTask
Signatures:
-
com.box.sdk.BoxTask addFileTask(String fileId, com.box.sdk.BoxTask.Action action, java.util.Date dueAt, String message);
The box/addFileTask API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
action | The action the task assignee will be prompted to do: REVIEW or COMPLETE. | Action |
dueAt | The date and time at which this task is due | Date |
fileId | The id of file to add task to | String |
message | An optional message to include with the task | String |
Method deleteTask
Signatures:
-
void deleteTask(String taskId);
The box/deleteTask API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
taskId | The id of task to delete | String |
Method deleteTaskAssignment
Signatures:
-
void deleteTaskAssignment(String taskAssignmentId);
The box/deleteTaskAssignment API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
taskAssignmentId | The id of task assignment to delete | String |
Method getFileTasks
Signatures:
-
java.util.List<com.box.sdk.BoxTask.Info> getFileTasks(String fileId);
The box/getFileTasks API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fileId | The id of file | String |
Method getTaskAssignmentInfo
Signatures:
-
com.box.sdk.BoxTaskAssignment.Info getTaskAssignmentInfo(String taskAssignmentId);
The box/getTaskAssignmentInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
taskAssignmentId | The id of task assignment | String |
Method getTaskAssignments
Signatures:
-
java.util.List<com.box.sdk.BoxTaskAssignment.Info> getTaskAssignments(String taskId);
The box/getTaskAssignments API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
taskId | The id of task | String |
Method getTaskInfo
Signatures:
-
com.box.sdk.BoxTask.Info getTaskInfo(String taskId);
The box/getTaskInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
taskId | The id of task | String |
Method updateTaskInfo
Signatures:
-
com.box.sdk.BoxTask updateTaskInfo(String taskId, com.box.sdk.BoxTask.Info info);
The box/updateTaskInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
info | The updated information | Info |
taskId | The id of task | String |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
API: users
Only producer is supported
The users API is defined in the syntax as follows:
box:users/methodName?[parameters] The 11 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
addEmailAlias | Add a new email alias to user’s account | |
create | Provision a new app user in an enterprise with additional user information using Box Developer Edition | |
create | Provision a new user in an enterprise with additional user information | |
delete | Delete user from an enterprise account | |
delete | Delete an email alias from user’s account | |
users | Get the managed users of the enterprise whose name or login starts with the filter term, or all of them when no filter term is given | |
currentUser | Get current user | |
emailAlias | Get a collection of all the email aliases for user | |
info | Get user information | |
Move the content of the root folder of the source user into a new folder of the user with the given id | ||
updateInfo | Update user information |
Method addUserEmailAlias
Signatures:
-
com.box.sdk.EmailAlias addUserEmailAlias(String userId, String email);
The box/addUserEmailAlias API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
The email address to add as an alias | String | |
userId | The id of user | String |
Method createAppUser
Signatures:
-
com.box.sdk.BoxUser createAppUser(String name, com.box.sdk.CreateUserParams params);
The box/createAppUser API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
name | The name of the user | String |
params | Additional user information | CreateUserParams |
Method createEnterpriseUser
Signatures:
-
com.box.sdk.BoxUser createEnterpriseUser(String login, String name, com.box.sdk.CreateUserParams params);
The box/createEnterpriseUser API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
login | The email address the user will use to login | String |
name | The name of the user | String |
params | Additional user information | CreateUserParams |
Method deleteUser
Signatures:
-
void deleteUser(String userId, boolean notifyUser, boolean force);
The box/deleteUser API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
force | Whether or not this user should be deleted even if they still own files | Boolean |
notifyUser | Whether or not to send an email notification to the user that their account has been deleted | Boolean |
userId | The id of user to delete | String |
Method deleteUserEmailAlias
Signatures:
-
void deleteUserEmailAlias(String userId, String emailAliasId);
The box/deleteUserEmailAlias API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
emailAliasId | The id of the email alias to delete | String |
userId | The id of user | String |
Method getAllEnterpriseOrExternalUsers
Signatures:
-
java.util.List<com.box.sdk.BoxUser.Info> getAllEnterpriseOrExternalUsers(String filterTerm, String[] fields);
The box/getAllEnterpriseOrExternalUsers API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
fields | The fields to retrieve; if null the standard fields are retrieved. Used only with filterTerm. | String[] |
filterTerm | The text that the name or login of the users starts with; if null all managed users are returned. | String |
Method getCurrentUser
Signatures:
-
com.box.sdk.BoxUser getCurrentUser();
The box/getCurrentUser API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|
Method getUserEmailAlias
Signatures:
-
java.util.Collection<com.box.sdk.EmailAlias> getUserEmailAlias(String userId);
The box/getUserEmailAlias API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
userId | The id of user | String |
Method getUserInfo
Signatures:
-
com.box.sdk.BoxUser.Info getUserInfo(String userId);
The box/getUserInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
userId | The id of user | String |
Method moveFolderToUser
Signatures:
-
com.box.sdk.BoxFolder.Info moveFolderToUser(String userId, String sourceUserId);
The box/moveFolderToUser API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
sourceUserId | The user id of the user whose files will be the source for this operation | String |
userId | The id of the user that receives the content | String |
Method updateUserInfo
Signatures:
-
com.box.sdk.BoxUser updateUserInfo(String userId, com.box.sdk.BoxUser.Info info);
The box/updateUserInfo API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
info | The updated information | Info |
userId | The id of user to update | String |
In addition to the parameters above, the box API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelBox.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelBox.myParameterNameHere header.
Message Headers
The Box component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
| Constant: | The prefix of the headers that carry the parameters of the API method: the header CamelBox.fileName holds the fileName parameter. | Object |
Message Body
The message body at each side of the Box component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| events/listen is the only consumer: one message per event of the Box event stream, a BoxEvent. |
Producer input |
| The body is used only when inBody names a parameter of the method, and must then be of the type of that parameter: an InputStream for content of files/uploadFile and fileContent of files/uploadNewFileVersion (convertBodyTo java.io.InputStream after a file consumer), or text for an id such as fileId. Without inBody the arguments come from the options and the CamelBox. headers. Not known when |
Producer output |
| The return value of the method: a Box SDK object, such as the BoxFile of files/uploadFile, the BoxFolder of folders/createFolder or the Info of files/getFileInfo; a Collection or a List for the methods that list, such as folders/getFolderItems; null for the deletes and the other methods without a result. files/downloadFile writes the content to the OutputStream of the output option or the CamelBox.output header and gives that OutputStream, not the content. |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
| This is an API-based component, so per-call parameters can be supplied through |
Usage
Connection Authentication Types
The Box component supports three different types of authenticated connections.
Standard Authentication
Standard Authentication uses the OAuth 2.0 three-legged authentication process to authenticate its connections with Box.com. This type of authentication enables Box managed users and external users to access, edit, and save their Box content through the Box component.
App Enterprise Authentication
App Enterprise Authentication uses the OAuth 2.0 with JSON Web Tokens (JWT) to authenticate its connections as a Service Account for a Box Application. This type of authentication enables a service account to access, edit, and save the Box content of its Box Application through the Box component.
App User Authentication
App User Authentication uses the OAuth 2.0 with JSON Web Tokens (JWT) to authenticate its connections as an App User for a Box Application. This type of authentication enables app users to access, edit, and save their Box content in its Box Application through the Box component.
Examples
The following route uploads new files to the user’s root folder:
-
Java
-
XML
-
YAML
from("file:...")
.setHeader("CamelBox.fileName", header("CamelFileName"))
.to("box://files/upload?inBody=content&parentFolderId=0"); <route>
<from uri="file:..."/>
<setHeader name="CamelBox.fileName">
<header>CamelFileName</header>
</setHeader>
<to uri="box://files/upload?inBody=content&parentFolderId=0"/>
</route> - route:
from:
uri: file:...
steps:
- setHeader:
name: CamelBox.fileName
header: CamelFileName
- to:
uri: box://files/upload
parameters:
inBody: content
parentFolderId: "0" The following route polls user’s account for updates:
-
Java
-
XML
-
YAML
from("box://events/listen?startingPosition=-1")
.to("bean:blah"); <route>
<from uri="box://events/listen?startingPosition=-1"/>
<to uri="bean:blah"/>
</route> - route:
from:
uri: box://events/listen
parameters:
startingPosition: -1
steps:
- to:
uri: bean:blah The following route uses a producer with dynamic header options. The fileId property has the Box file id and the output property has the output stream of the file contents, so they are assigned to the CamelBox.fileId header and CamelBox.output header respectively as follows:
from("direct:foo")
.setHeader("CamelBox.fileId", header("fileId"))
.setHeader("CamelBox.output", header("output"))
.to("box://files/download")
.to("file://..."); More information
See more details at the Box API reference: https://developer.box.com/reference