Add row
DataTablesAddRow collection allows adding new rows to Data Tables using HTTP POST method. It is possible to add a single row or multiple rows with one request.
Request data format
Data element children:
Column element children:
To add multiple rows, use MultiData element instead of Data element (this option is deprecated - please use Add multiple rows method):
Examples
Request (adding single row):
POST https://api.esv2.com/v2/Api/DataTablesAddRow/ HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 269
<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>
<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>
</Data>
</ApiRequest>
Request (adding multiple rows) this option is deprecated - please use Add multiple rows method:
POST https://api.esv2.com/v2/Api/DataTablesAddRow/ HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 269
<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>
<MultiData>
<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>
</MultiData>
</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
Cache-Control: private
Content-Type: text/xml; charset=utf-8
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 11:32:07 GMT
Content-Length: 239
<ApiResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ErrorMessage>
<Code>400</Code>
<Message>Row with specified criteria already exists</Message>
</ErrorMessage>
</ApiResponse>
Request (inserting NULL value into column):
POST https://api.esv2.com/v2/Api/DataTablesAddRow/ HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 187
<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>
<Columns>
<Column>
<Name>NotNullColumn</Name>
<Value>some value</Value>
</Column>
<Column>
<Name>NullableColumn</Name>
<Value xsi:nil="true"/>
</Column>
</Columns>
</Data>
</ApiRequest>