Insert

The Insert action uses an appropriate connector to insert a document or documents into a repository.

http://host:port/action=Fetch&FetchAction=Insert
                         &AUTN_GROUP=ConnectorGroup
                         &Config=Base64_Config
                         &ConfigSection=Section_Name
                         &InsertXML=Insert_XML

Type: Asynchronous

Parameter Name Description Required
AUTN_GROUP The connector group to send the action to. Yes
Config An optional Base64 encoded configuration file, used to override the connector configuration file.  
ConfigSection The name of the task section in the connector's configuration file to use to insert the documents.  
FailedDirectory The directory in which to report failures.  
InsertXML

XML containing all the properties to determine how and where to add each document, all the metadata, and optionally, a file to insert for each document. Some connectors require a file.

The data must be provided in XML format as below:

<InsertXML>
  <insert>
    <reference>reference</reference>
    <section>configsection</section>
    <property name="propname" value="propvalue"/>
    <!-- ... -->
    <metadata name="fieldname" value="fieldvalue"/>
    <!-- ... -->
    <file>
      <type>type</type>
      <displayname>filename</displayname>
      <content>content</content>
    </file>
    <insert_id>012345</insert_id>
  </insert>
  <!-- ... -->
</InsertXML>

Most of the tags are optional.

  • insert. The insert tag can be omitted if a single document is being inserted.
  • reference, property, metadata. The usage of these tags depends on the connector used. For more information about using the insert fetch action, refer to Administration Guide for your connector.
  • section. The name of the task section (in the configuration file) to use to insert the document. The default value is specified by the ConfigSection action parameter, but if you specify a different value in the InsertXML, the value in the InsertXML takes priority.
  • file. Specifies information about the file to insert. If you include the <file> element, you must include at least <content>.
  • type. The type element specifies the type of data included in the following <content> element. Use one of the following values:

    • file - The content element contains a file name. The file is not owned by the connector, so the connector does not delete it after the action succeeds.
    • tempfile - The content element contains a file name. The file is owned by the connector and is deleted after the action succeeds.
    • content - The content element contains the body of the file base64 encoded.
    • drecontent - The content element contains the document DRECONTENT.
    • dataid - The file has been previously sent to the connector's DataPort with the dataid set in the content element.
  • displayname - used for logging and when writing the data to a temporary file.
  • insert_id. This tag is optional and specifies a unique ID for the document. The response to the insert fetch action reports which documents were successfully inserted by returning the specified IDs. To see the IDs, you must set the Distributed Connector configuration parameter AddIdsFromFinished to true.
Yes

Example

This example shows how to use a connector group called FileSystemConnectors to insert a file with the reference C:\Autonomy\dir1\newfile.txt with the content This is my file into a file system.

  1. Construct the InsertXML:

    <insertXML>
      <insert>
        <reference>C:\Autonomy\dir1\newfile.txt</reference>
        <file>
          <type>content</type>
          <content>VGhpcyBpcyBteSBmaWxl</content>
        </file>
        <insert_id>012345</insert_id>
      </insert>
    </insertXML>

    NOTE: The content This is my file is base64 encoded.

  2. The XML is then URL encoded and used in the Insert action:

    http://localhost:10000/action=Fetch&FetchAction=Insert
                        &AUTN_GROUP=FileSystemConnectors
                        &ConfigSection=DIR1
                        &InsertXML=...

Response

As this is an asynchronous action, you receive a token in response to the request. You can use the token with the QueueInfo action to retrieve more information about the request.

The response to /action=QueueInfo&QueueAction=getStatus&QueueName=fetch&token=... provides a ConnectorToken (the token returned by the connector when it was passed the action by the Distributed Connector). You can then use the ConnectorToken to find the response from the connector in the Distributed Connector's fetchfinished queue.

The response to /action=QueueInfo&QueueAction=getStatus&QueueName=FetchFinished looks like this:

<action>
  <status>Finished</status>
  <queued_time>2014-Jun-04 12:10:56</queued_time>
  <time_in_queue>0</time_in_queue>
  <process_start_time>2014-Jun-04 12:10:56</process_start_time>
  <time_processing>0</time_processing>
  <process_end_time>2014-Jun-04 12:10:56</process_end_time>
  <FinalBatch>true</FinalBatch>
  <ParentToken>MTAuMi4xMDQuODI6MTAwMDA6RkVUQ0g6MTU5NjUyNzE0Mg==</ParentToken>
  <errors>0</errors>
  <identifiers>
    <identifier insert_id="012345">PGlkIHM9IkZFVENIVEFTS1MiIHI9IkM6XEF1dG9ub215XFxkaXIxXG5ld2ZpbGUudHh0Ii8+</identifier>
  </identifiers>
  <inserted>1</inserted>
  <token>MTAuMi4xMDQuODI6MTAwMDA6RkVUQ0hGSU5JU0hFRDoxODUwMjA0Njc=</token>
</action>

The insert_id is the value that you specified in the original request, and the <identifier> element contains a document identifier for the document in the repository. To see the identifiers, you must set the configuration parameter AddIdsFromFinished to true.