Przejdź do treści

Add multiple rows

DataTablesAddMultipleRows allows adding multiple new rows to Data Tables using HTTP POST method.

Request data format

ApiRequest element children:

ParameterTypeNotes
ApiKeystringYour API key, required for authentication. Required.
TableNamestringName of Data Table. Required.
DatacomplexObject containing rows data.

Data element children:

ParameterTypeNotes
ColumnscomplexCollection of Column elements.

Column element children:

ParameterTypeNotes
NamestringColumn name. Required.
ValuestringField value. Required.

Examples

Request:

POST https://api.esv2.com/v2/Api/DataTablesAddMultipleRows/ HTTP/1.1

<ApiRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <ApiKey>test_api_key1</ApiKey>
  <TableName>Table1</TableName>
  <Data>
    <Row>
      <Columns>
        <Column>
          <Name>Column1</Name>
          <Value>Value1</Value>
        </Column>
        <Column>
          <Name>Column2</Name>
          <Value>2</Value>
        </Column>
        <Column>
          <Name>Column3</Name>
          <Value>2013-01-01 01:00:00 PM</Value>
        </Column>
        <Column>
          <Name>Column4</Name>
          <Value>4.66</Value>
        </Column>
        <Column>
          <Name>Column5</Name>
          <Value>True</Value>
        </Column>
      </Columns>
    </Row>
    <Row>
      <Columns>
        <Column>
          <Name>Column1</Name>
          <Value>Value2</Value>
        </Column>
        <Column>
          <Name>Column2</Name>
          <Value>3</Value>
        </Column>
        <Column>
          <Name>Column3</Name>
          <Value>2013-01-01 01:00:00 PM</Value>
        </Column>
        <Column>
          <Name>Column4</Name>
          <Value>4.66</Value>
        </Column>
        <Column>
          <Name>Column5</Name>
          <Value>True</Value>
        </Column>
      </Columns>
    </Row>
  </Data>
</ApiRequest>

OK response:

HTTP/1.1 201 Created
Cache-Control: private
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 1.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Wed, 28 Oct 2009 15:35:17 GMT
Content-Length: 0

Error response:

HTTP/1.1 400 Bad Request

<ApiResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ErrorMessage>
    <Code>400</Code>
    <Messages>
      <Message for="Row 1">Row with specified criteria already exists.</Message>
      <Message for="Row 2">Request does not contain required columns.</Message>
      <Message for="Row 3">Row with specified criteria already exists.</Message>
    </Messages>
  </ErrorMessage>
</ApiResponse>

Please note that the error response contains information about errors in specific rows (identified by the index number of a row, starting from 1). If there were rows that were not reported here as an error it means that those rows were successfully added to data tables.