August 17, 2023

tBoxPut – Docs for ESB 5.x

tBoxPut

tboxput_icon32_white.png

tBoxPut properties

Component family

Cloud/Box

 

Function

This component uploads data to Box from either a local file or a given data
flow.

Purpose

The tBoxPut component uploads files to a Box account.

Basic settings

Use existing connection

Select this check box and in the Component List click the
relevant connection component to reuse the connection details you already defined.

 

Connection/Client Key

Enter the client key required by Box to access the Box API. To obtain the client key and
client secret you need to create an account at https://developers.box.com/ and then create a Box App under the Box account to
be used. The client key and client secret can be obtained from the account application
settings.

 

Connection/Client Secret

Enter the client secret required by Box to access the Box API. To obtain the client key and
client secret you need to create an account at https://developers.box.com/ and then create a Box App under the Box account to
be used. The client key and client secret can be obtained from the account application
settings.

 

Connection/Access Token

Enter the access token required by Box to access a Box account and operate it. For how to get
the access token and refresh token, see the sample at https://github.com/box/box-java-sdk-v2/wiki/HelloWorld.

 

Connection/Refresh Token

Enter the refresh token required by Box to refresh the access token automatically. For how to
get the access token and refresh token, see the sample at https://github.com/box/box-java-sdk-v2/wiki/HelloWorld.

 

Connection/Use HTTP proxy

If you are using a proxy, select this check box and enter the host and port information of
that proxy in the corresponding fields that are displayed.

 

Remote Path

Enter the path pointing to the file you need to write contents in. This file will be
created on the fly if it does not exist.

 

Replace if Existing

Select this check box to use the uploaded file to replace the
existing one.

 

Upload mode

Select the upload mode to be used:

  • Upload incoming content as file: Select this radio
    button to read data directly from the input flow of the
    preceding component and write the data into the file
    specified in the Remote
    Path
    field.

  • Upload local file: Select this radio button to
    upload a locally stored file to Box. In the File field that is displayed,
    you need to enter the path or browse to this
    file.

  • Expose as OutputStream: Select this check box to
    expose the output stream of this component, which can be
    used by the other components to write the file content.
    For example, you can use the Use
    output stream
    feature of the tFileOutputDelimited
    component to feed a given tBoxPut‘s exposed output stream. For
    further information, see tFileOutputDelimited.

 

Schema and Edit schema

A schema is a row description. It defines the number of fields to be processed and passed on
to the next component. The schema is either Built-In or
stored remotely in the Repository.

Note that the schema of this component is read-only with a single
column named content and it
receives data from the content
column of its input schema only. This means that you must use a
content column in the input
data flow to carry the data to be uploaded. This type of column is
typically provided by the tFileInputRaw component. For further information,
see tFileInputRaw.

The Schema field is not available when you have
selected the Expose as OutputStream
or the Upload local file upload
mode.

Advanced settings

tStatCatcher Statistics

Select this check box to collect log data at the component
level.

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This component is used either standalone in a Subjob to directly upload a local file to
Box or as an end component of a Job flow to upload given data being
handled in this flow.

Limitation

n/a

Scenario: Uploading and downloading files from Box

In this scenario, a three-component Job consisting of three Subjobs is created to upload a
file to Box and then download a file from Box to the local file system.

use_case-tboxput1.png

Before replicating this scenario, you need to create an account at https://developers.box.com/ and then create a Box App under the Box account
to be used. For more information about Box App, see https://app.box.com/developers/services/edit/. The client key and client
secret can be obtained from the account application settings. For how to get the access
token and refresh token, see the sample App at https://github.com/box/box-java-sdk-v2/wiki/HelloWorld.

Linking the components

  1. In the Integration perspective of the Studio, create
    an empty Job from the Job Designs node in
    the Repository tree view.

    For further information about how to create a Job, see Talend Studio User Guide.

  2. In the workspace, enter the name of the component to be used and select this component
    from the list that opens. In this scenario, the components are tBoxConnection, tBoxPut and tBoxGet.

  3. Connect tBoxConnection to tBoxPut using the Trigger >
    OnSubjobOk
    link.

  4. Connect tBoxPut to tBoxGet
    using the Trigger > OnSubjobOk link.

Configuring the components

  1. Double-click tBoxConnection to open its Component view.

    use_case-tboxput2.png
  2. Enter the client key, client secret, access token and refresh token in double quotation
    marks in the relevant fields for accessing the Box account.

  3. Double-click tBoxPut to open its
    Component view.

    use_case-tboxput3.png
  4. Select the Use Existing Connection check box to reuse
    the connection created by tBoxConnection.

    In the Remote Path field, enter the
    destination path where you want to upload the file.

    In the Upload mode area, select Upload Local File. In the File field, enter the file path or browse to the file you
    want to upload.

  5. Double-click tBoxGet to open its
    Component view.

    use_case-tboxput4.png
  6. Select the Use Existing Connection check
    box to reuse the connection created by tBoxConnection.

    In the Path field, enter the path of the
    file that you want to download.

    Select the Save As File check box. In the
    Save To field, enter the file path
    where to save the file on the local file system.

  7. Save the Job.

Executing the Job

Execute the Job by pressing F6 or clicking the Run button on the Run
tab.

The local file, hello.txt in this example, is uploaded in your
Box.

use_case-tboxput5.png

The file box.txt from Box is downloaded to the local file
system.

use_case-tboxput6.png

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x