org.mule.modules

mule-module-boxnet


Namespacehttp://www.mulesoft.org/schema/mule/boxnet
Schema Locationhttp://www.mulesoft.org/schema/mule/boxnet/current/mule-boxnet.xsd  (View Schema)
Schema Version1.0
Minimum Mule Version3.2

Module Overview

Box.net Cloud Connector Module.

Summary

Configuration
<boxnet:config>
Configure an instance of this module
Message Processors
<boxnet:add-to-tag>
This processor adds file or folder to tags list.
<boxnet:auth-token>
After the user authenticates the ticket obtained with the get-ticket processor, there're two ways to get the required auth token:
  1. You can configure box.net to make a callback returning the ticket and authToken, in which case you need to set the usesCallback and callbackPath config attributes accordingly
  2. You can use this processor to obtain the authentication token explicitly.
<boxnet:create-folder>
Create a new folder
<boxnet:delete>
Deletes a file or folder
<boxnet:download>
Downloads a file an returns its contents as a byte[]
<boxnet:export-tags>
This processor returns all the user's tags.
<boxnet:get-file-info>
Gets information about a file
<boxnet:get-ticket>
Get and access ticket using the configured apiKey.
<boxnet:get-tree-structure>
This processor is used to get a user's files and folders tree.
<boxnet:logout>
Logs out the user associated with the authorization token
<boxnet:move>
This processor moves a file or folder to another folder.
<boxnet:private-share>
This processor privately shares a file or folder with another user(s).
<boxnet:public-share>
Makes a public share of a file or folder
<boxnet:public-unshare>
This processor unshares a public shared file or folder
<boxnet:register-new-user>
Create a new user in box.net
<boxnet:rename>
This processor renames a file or folder.
<boxnet:set-description>
This processor sets a description to a file or folder.
<boxnet:upload-files>
Receives a comma separated list of paths and uploads the corresponding files.
<boxnet:upload-stream>
Receives an input stream and uploads its content as a file
<boxnet:verify-registration-email>
This method is used to verify user registration email

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:boxnet="http://www.mulesoft.org/schema/mule/boxnet"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/boxnet
               http://www.mulesoft.org/schema/mule/boxnet/current/mule-boxnet.xsd">

      <!-- here goes your flows and configuration elements -->

</mule>

This module is configured using the config element. This element must be placed outside of your flows and at the root of your Mule application. You can create as many configurations as you deem necessary as long as each carries its own name.

Each message processor, message source or transformer carries a config-ref attribute that allows the invoker to specify which configuration to use.

Attributes
TypeNameDefault ValueDescription
xs:string name Optional. Give a name to this configuration so it can be later referenced.
xs:string apiKey The API key obtained when registering a project with the Box platform.
xs:string callbackPath box_auth_callback Optional. The url where box.net will direct the authentication callback.
xs:int callbackPort 8080 Optional. The port where the authentication callback will be listening on Defaults to 8080
xs:boolean usesCallback false Optional. If true, an http inbound endpoint will be set in place to receive a callback from box.net with the authToken once the user has authenticated.

Message Processors

<boxnet:add-to-tag>

This processor adds file or folder to tags list.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
csvTags Comma separated list of tags
target Can be either 'file' or 'folder' depending on what do you want to add
targetId The id of a file or folder to be added
Child Elements
Return Payload
  • 'addtotag_ok' if successful. Otherwise addtotag_error.
Exception Payloads
Payload ClassDescription
IllegalArgumentException} if target is invalid or csvTags is empty

<boxnet:auth-token>

After the user authenticates the ticket obtained with the get-ticket processor, there're two ways to get the required auth token:

  1. You can configure box.net to make a callback returning the ticket and authToken, in which case you need to set the usesCallback and callbackPath config attributes accordingly
  2. You can use this processor to obtain the authentication token explicitly.
Either way, this connector will retain the authToken in memory and will use it in all operations. For more info look at http://developers.box.net/w/page/12923915/ApiAuthentication
XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
Child Elements
Return Payload
  • the authentication token
Exception Payloads
Payload ClassDescription
IllegalArgumentException if the ticket does not match a logged user
IllegalStateException if you use this processor before getting a ticket

<boxnet:create-folder>

Create a new folder

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
parentFolderId The id of the parent folder
folderName The name of the folder you want to create
share false Optional. Specifies if the folder is shared. This parameter is optional and defaults to false
Child Elements
Return Payload
  • an instance of CreateFolderResponse with data about the operation status and info about the newly created folder (if successful)

<boxnet:delete>

Deletes a file or folder

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target The type of item to be shared. This can be set as 'file' or 'folder'. Any other value will throw a IllegalArgumentException
targetId The id of the item you wish to delete. If the target is a folder, this will be the folder_id. If the target is a file, this will be the file_id.
Child Elements
Return Payload
Exception Payloads
Payload ClassDescription
IllegalArgumentException} if target is invalid

<boxnet:download>

Downloads a file an returns its contents as a byte[]

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
fileId The id of the file we want to download
Child Elements
Return Payload
  • the file's contents as a byte array

<boxnet:export-tags>

This processor returns all the user's tags. On successful you will get an xml representing the tags that looks like this: music mp3 If the result wasn't successful, status field can be: not_logged_id, application_restricted.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
encoding UTF-8 Optional. Encoding to use when decoding from BASE64. Optional, defaults to UTF-8
Child Elements
Return Payload
  • a String xml representing the tags

<boxnet:get-file-info>

Gets information about a file

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
fileId The id of the file you want info about
Child Elements
Return Payload

<boxnet:get-ticket>

Get and access ticket using the configured apiKey. With this ticket, the user needs to manually go to https://www.box.net/api/1.0/auth/ For more info look at http://developers.box.net/w/page/12923915/ApiAuthentication

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
Child Elements
Return Payload
  • the ticket key

<boxnet:get-tree-structure>

This processor is used to get a user's files and folders tree. 'folderId' param defines root folder from which the tree begins. 'csvParams' is comma separated list where you can set additional parameters, which are: onelevel - make a tree of one level depth, so you will get only files and folders stored in folder which folder_id you have provided. nofiles - include folders only in result tree, no files. nozip - do not zip tree xml. On successful result you will receive 'listing_ok' as status and the tree xml. if you haven't set 'nozip' as a parameter (it's set by default), then you have to unzip it. Then you will get xml like this: (note that updatedand createdare UNIX timestamps in PST).

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
folderId 0 Optional. The ID of the root folder from which the tree begins. If this value is "0", the user's full account tree is returned. Defaults to zero
csvParams nozip Optional. Comma separated list of params. This is optional and defaults to 'nozip'
encoding UTF-8 Optional. Optional parameter to specify the encoding to use when decoding BASE64. Defaults to UTF-8
Child Elements
Return Payload
  • an instance of GetAccountTreeResponse with data about the operation status and info about the inspected folder (if successful)

<boxnet:logout>

Logs out the user associated with the authorization token

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
Child Elements
Return Payload

<boxnet:move>

This processor moves a file or folder to another folder. On a successful result, status will be 's_move_node'. If the result wasn't successful, status field can be: 'e_move_node', 'not_logged_in', 'application_restricted'.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target Can be either 'file' or 'folder' depending on what do you
targetId Is the id of a file or folder to be moved
destinationId Is the destination folder id.
Child Elements
Return Payload
  • if successful 's_move_node'. Otherwise it can be 'e_move_node', 'not_logged_in', 'application_restricted'.

<boxnet:private-share>

This processor privately shares a file or folder with another user(s). 'target' param, 'target_id' is . 'emails' params is an array of emails of users' to share files with. if 'notify' param is , 'message' param . Note: currently only files can be shared privately.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target Should be either 'file' or 'folder'
targetId The id of the file or folder to be shared
csvMails Comma separated list of email addresses of the users that will receive the share
notify true Optional. If true, then a notification email will be sent to users. Optional parameter, defaults to true
message Optional. Is a message to be included in the notification email. Optional parameter, defaults to an empty string
Child Elements
Return Payload
  • if successful will be 'private_share_ok'. Otherwise can be: 'private_share_error', 'wrong_node', 'not_logged_in', 'application_restricted'.
Exception Payloads
Payload ClassDescription
IllegalArgumentException} if target is invalid or csvMails is null or empty

<boxnet:public-share>

Makes a public share of a file or folder

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target The type of item to be shared. This can be set as 'file' or 'folder'. Any other value will throw a IllegalArgumentException
targetId The id of the item you wish to share. If the target is a folder, this will be the folder_id. If the target is a file, this will be the file_id.
password The password to protect the folder or file.
message An message to be included in a notification email.
Child Elements
Return Payload
  • an instance of PublicShareResponse with data about the operation status and info about the shared folder (if successful)
Exception Payloads
Payload ClassDescription
IllegalArgumentException} if target is invalid

<boxnet:public-unshare>

This processor unshares a public shared file or folder

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target Shoud be either 'file' or 'folder'
targetId Is id of a file or folder to be unshared
Child Elements
Return Payload
  • On a successful result, the status will be 'unshare_ok'. If the result wasn't successful, the status field can be: 'unshare_error', 'wrong_node', 'not_logged_in', 'application_restricted'.
Exception Payloads
Payload ClassDescription
IllegalArgumentException} if target is invalid

<boxnet:register-new-user>

Create a new user in box.net

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
email The user's email
password The user's password
Child Elements
Return Payload
  • an instance of RegisterNewUserResponse with data about the operation status and info about the newly created user (if successful)

<boxnet:rename>

This processor renames a file or folder.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target Can be either 'file' or 'folder' depending on what you want to rename
targetId Is the id of a file or folder to be renamed
newName Is the new name for a file or folder
Child Elements
Return Payload
  • if successful will be 's_rename_node'. Otherwise it can be: 'e_rename_node', 'not_logged_in', 'application_restricted'

<boxnet:set-description>

This processor sets a description to a file or folder.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
target Can be either 'file' or 'folder'
targetId The id of the folder/file you want to modify
description The description you want to set
Child Elements
Return Payload
  • 's_set_description' if successful. 'e_set_description' otherwise.

<boxnet:upload-files>

Receives a comma separated list of paths and uploads the corresponding files.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
folderId 0 Optional. The id of the parent folder. Defaults to 0 (the root folder)
Child Elements
<boxnet:paths>
A List of Strings with the paths where the files are. Defaults to payload
Return Payload
  • an instance of UploadResponse with data about the operation status and info about the newly uploaded files (if successful)

<boxnet:upload-stream>

Receives an input stream and uploads its content as a file

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
folderId 0 Optional. The id of the parent folder. Defaults to 0 which is the root folder
filename The name we want the file to have on box.net
input InputStream with the contents of the file. It's taken from the message payload.
Child Elements
Return Payload
  • an instance of UploadResponse with data about the operation status and info about the newly uploaded file (if successful)

<boxnet:verify-registration-email>

This method is used to verify user registration email

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescription
config-ref Optional. Specify which configuration to use.
loginName The login username of the user for which you would like to verify registration.
Child Elements
Return Payload
  • Upon a successful registration, the return value will be 'email_ok'. If registration was not successful, it can be: 'email_invalid' - The login provided is not a valid email address. 'email_already_registered' - The login provided is already registered by another user. 'application_restricted'- You provided an invalid api_key, or the api_key is restricted from calling this function.