Adapter requests and responses for the CSV adapter

This section describes the requests and responses of the CSV adapter for the following actions:

  • Read
  • Write
  • Delete

CSV adapter request and responses for the Read action

The Read action reads the data in the CSV file.

The following table describes the adapter request elements for the CSV adapter with a Read action.

ElementDescriptionRequired
<file-name>Specifies the name and location of the file which you want the adapter to readYes
<delimiter>

Specifies a character that is used to indicate the end of one field and the beginning of the next

Default value: ,

No
<text-qualifier>

Specifies a character that differentiates field data from a delimiter

Each field's data is between the text qualifier.

For example, the field data contains a comma and a comma is used as a record delimiter, then text qualifier must be used to distinguish between the comma’s in the data and the comma’s used to delimit fields.

Default value: (")

No
<read-headers>

Specifies whether to read the first row in the data as column headers

Valid values: true, false (default)

No
<charset>Specifies the supporting CharSet 

Also called character set, it includes identifiers describing a series of universal characters.
No
<start-index>

Specifies the row from where the adapter starts reading the rows in the CSV file

Default value: 0

0 indicates that the adapter starts reading the CSV file data from the first row.

No
<maximum-rows>

Specifies the number of rows to be read from the CSV file starting from the start index

For example: if the <start-index> is 5 and <maximum-rows> is 10, the adapter reads from row 5 to 15 in the CSV file.

Default value: 0; reads all rows in a file.

No

The following figure describes an XML request sample for the CSV adapter with a Read action.

XML request sample for the CSV adapter with a Read action

<csv-adapter-request>
    <start-index />
    <operation-name>read</operation-name>
    <file-name>C:\test.csv</file-name>
    <delimiter />
    <text-qualifier />
    <read-headers />
    <maximum-rows />
    <charset />
  </csv-adapter-request>

The following figure describes a sample response for the CSV adapter with a Read action

XML response sample for the CSV adapter with a Read action

<csv-adapter-response>
  <metadata>
    <status>success</status>
  </metadata>
  <read-response>
    <rows row-count="2">
      <row index="1">
        <column index="1">Name'Education'Designation</column>
      </row>
      <row index="2">
        <column index="1">Martin'B.tech'"Lead   "</column>
      </row>
    </rows>
  </read-response>
</csv-adapter-response>

CSV adapter request and responses for the Write action

The Write action writes the data to the CSV file.If a file already exists, the Write action overwrites the rows in the file, without any indication.

The following table describes the adapter request elements for the CSV adapter with a Write action.

ElementDescriptionRequired
<file-name>Specifies the name and location of the file which you want the adapter to readYes
<delimiter>

Specifies a character that is used to indicate the end of one field and the beginning of the next

Default value: (,)

No
<text-qualifier>

Specifies a character that differentiates field data from a delimiter

Each field's data is between the text qualifier.

For example, the field data contains a comma and a comma is used as a record delimiter, then text qualifier must be used to distinguish between the comma’s in the data and the comma’s used to delimit fields.

Default value: (")

No
<preserve-spaces>

Specifies whether to preserve spaces between the values in a CSV file

Valid value: true, false

No
<charset>Specifies the supporting CharSet 

Also called character set, it includes identifiers describing a series of universal characters.
No
<rows>

Specifies a row to be added to the CSV file

Contains the columns element.

Yes
<column>Specifies the column to be created within a row in the CSV fileYes

The following figure describes an XML request sample for the CSV adapter with a Write action.

XML request sample for the CSV adapter with a Write action

<csv-adapter-request>
    <operation-name>write</operation-name>
    <file-name>C:\test.csv</file-name>
    <delimiter>'</delimiter>
    <text-qualifier>"</text-qualifier>
    <preserve-spaces>true</preserve-spaces>
    <charset />
    <rows>
      <row>
        <column>Name</column>
        <column>Education</column>
        <column>Designation</column>
      </row>
      <row>
        <column>Martin</column>
        <column>B.tech</column>
        <column>Lead   </column>
      </row>
    </rows>
</csv-adapter-request>

The following figure describes a sample response for the CSV adapter with a Write action

XML response sample for the CSV adapter with a Write action

<csv-adapter-response>
  <metadata>
    <status>success</status>
  </metadata>
  <write-response>
    <number-of-rows-written>2</number-of-rows-written>
  </write-response>
</csv-adapter-response>

CSV adapter request and responses for the Delete action

The Delete action deletes rows in the CSV file.

The following table describes the adapter request elements for the CSV adapter with a Delete action.

ElementDescriptionRequired
<file-name>Specifies the name and location of the file in which you want to delete specified rowsYes
<delimiter>

Specifies a character that is used to indicate the end of one field and the beginning of the next

Default value: ,

No
<text-qualifier>

Specifies a character that differentiates field data from a delimiter

Each field's data is between the text qualifier.

For example, the field data contains a comma and a comma is used as a record delimiter, then text qualifier must be used to distinguish between the comma’s in the data and the comma’s used to delimit fields.

Default value: (")

No
<read-headers>

Specifies whether to read the first row in the data as column headers

Valid values: true, false (default)

No
<charset>Specifies the supporting CharSet 

Also called character set, it includes identifiers describing a series of universal characters.
No
<start-index>

Specifies the row from where you can start deleting the rows in the CSV file

Default Value: 0

If the <start-index> is 0, no rows are deleted from the file.

No
<maximum rows>

Specifies the number of rows to be deleted from the CSV file starting from start index

Default Value: 0 (No rows are deleted)

For example: if the <start-index> is 5 and <maximum-rows> is 10, in the CSV file, rows 5 to 15 are deleted.

No

The following figure describes an XML request sample for the CSV adapter with a Delete action.

XML request sample for the CSV adapter with a Delete action

<csv-adapter-request>
    <start-index>1</start-index>
    <operation-name>delete</operation-name>
    <file-name>C:\test.csv</file-name>
    <delimiter />
    <text-qualifier />
    <read-headers />
    <maximum-rows>2</maximum-rows>
    <charset />
</csv-adapter-request>

The following figure describes a sample response for the CSV adapter with a Delete action

XML response sample for the CSV adapter with a Delete action

<csv-adapter-response>
  <metadata>
    <status>success</status>
  </metadata>
  <delete-response>
    <rows row-count="2">
      <row index="1">
        <column index="1">Name'Education'Designation</column>
      </row>
      <row index="2">
        <column index="1">Martin'B.tech'"Lead   "</column>
      </row>
    </rows>
  </delete-response>
</csv-adapter-response>

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments