Insert

The Insert action inserts items into a repository.

Type: asynchronous

Parameter Description Required
ConnectorGroup

The name of the connector group to send the request to. This must match the name you specified when you configured the ConnectorGroupRouter processor in your dataflow.

Yes
Documents

XML that describes how to insert the item(s). Each item to insert is represented by a document element in the XML:

<documents>
    <document file_part_name="file_part" migration_uri="/folder/file.txt">
        <IDENTIFIER>
            <reference>/opt/files/file.txt</reference>
            <type>File</type>
            <property name="..." value="..." />
            <property name="..." value="..." />
        </IDENTIFIER>
    </document>
</documents>

The file_part_name attribute specifies the name of the part, in the multipart/form-data request, that contains the file to insert.

The migration_uri attribute is optional and sets the value of the idol.put.migrationuri FlowFile attribute. Some IDOL Connector Put* processors read this attribute, which is intended to support the migration of data between different types of data repository. If you set this attribute for each document you can route the FlowFiles directly to a supported Put* processor. For more information, see Migrate Data Between Repositories.

The IDENTIFIER element contains information about where to insert the item. The information that you must supply is different for each repository, and therefore for each connector.

  • The reference element is often used to supply a location, such as a path.
  • The type element describes the identifier type (the type of item to insert). The value of this element matches what would be returned by the Identifiers action.
  • Some repositories might need additional information, which can be supplied as a set of properties (name-value pairs).
Yes
Custom parameters

Any other parameters that you set are added to the FlowFile, created by the HandleAciRequest processor, that represents the action. When a connector processes the action, it adds the parameters to any FlowFiles that it generates.

The parameters are added as FlowFile attributes named idol.aci.param.name, where name is the name of the parameter that you set.

FlowFile attributes can be referenced by processor properties that support expression language, and can be read by Lua scripts. You can therefore set custom parameters to customize processing within NiFi.

The maximum size for a custom parameter value is 4KB.

No

Example

The following example uses the command-line tool cURL to send an insert action.

This example uses a File System Connector Group to insert a file into the file system. The file to insert is file.txt in the current working directory.

curl http://host:10000/action=Insert -F ConnectorGroup=FileSystem
                                     -F "Documents=<documents.xml"
                                     -F "file_part=@file.txt"

In this example, the XML that describes where to insert the item is read from the file documents.xml in the current working directory. This file might contain the following XML:

<documents>
    <document file_part_name="file_part">
        <IDENTIFIER>
            <reference>/opt/files/file.txt</reference>
            <type>File</type>
        </IDENTIFIER>
    </document>
</documents>

Notice that the value of the file_part_name attribute matches the name of the part, in the request, that contains the file to insert. The connector inserts the file into the file system at the location /opt/files/file.txt.

Response

This is an asynchronous action, so you receive a token in response to the request. You can use the QueueInfo action to see the result of the action, including the identifiers of successfully inserted documents.