Insert Data into Azure

The connector's insert fetch action can insert blobs into Azure Blob Storage. To use the insert action, you must construct some XML that specifies where to add each blob, and specifies the information to insert.

To insert a blob, specify the name of the file to insert using the filename property, and the name of the container using the container property. Use the file element to specify the content to insert. There are several ways to do this, such as specifying the path to a file or providing the content base-64 encoded. For more information about how to specify the source file, refer to the Azure Blob Connector Reference.

NOTE: The insert action does not create containers. Any container you specify must already exist.

The following example inserts a blob named file.txt in a container named container1. The file would contain the content "This is my file".

<insertXML>
  <insert>
    <property name="container" value="container1" />
    <property name="filename" value="file.txt" />
    <file>
      <type>content</type>
      <content>VGhpcyBpcyBteSBmaWxl</content>
    </file>
    <insert_id>012345</insert_id>
  </insert>
</insertXML>

The following example is the same, but uses the reference element specify where to insert the data. The reference must be in the form http://accountname.blob.core.windows.net/container/filename, where container is the container name and filename is the file name:

<insertXML>
  <insert>
    <reference>http://account.blob.core.windows.net/container1/file.txt</reference>
    <file>
      <type>content</type>
      <content>VGhpcyBpcyBteSBmaWxl</content>
    </file>
    <insert_id>012346</insert_id>
  </insert>
</insertXML>

Add the XML to the insert fetch action as the value of the insertXML action parameter. The XML must be URL encoded before being used in the action command. For example:

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

For more information about using the insert fetch action, refer to the Azure Blob Connector Reference.