Insert Files into Box

The connector's insert fetch action inserts files into the Box repository. To use the insert action, you must construct some XML that specifies where to add each file, and the information to insert. URL encode the XML and add it to the action as the value of the insertXML action parameter. For example:

http://host:port/action=Fetch
                          &FetchAction=Insert
                          &ConfigSection=MyTask
                          &InsertXML=[URL encoded XML]

The following table describes the properties that you must set in the insertXML provided to the insert action:

Property Description Required
ENTERPRISE_USER_LOGIN The login name of the user account to add the file to. If you are inserting files into Box Enterprise, you can set this property or the UID property. You can only use this property with Box Enterprise. No
PATH The desired destination path of the file in the Box repository, relative to the top-level accessible folder. Yes
UID The user ID of the Box user. Yes, unless you are inserting files into Box Enterprise and have set ENTERPRISE_USER_LOGIN instead.

For example:

<insertXML> 
   <insert> 
     <property name="PATH" value="/folder/file.txt"/>
     <property name="UID" value="..."/>
     <file> 
       <type>content</type> 
       <content>SGVsbG8gV29ybGQNCg==</content> 
     </file> 
   </insert> 
</insertXML>

The <file> element contains the file to insert into the repository. You can supply the path to a file, base-64 encoded content, or choose to send the file to the connector's data port. For more information about the insert fetch action and the XML elements you can use in the insertXML parameter, refer to the Box Connector Reference.