Delete row
DataTablesDeleteRow collection allows deleting existing rows using HTTP POST method. It is only possible to delete a single row with one request by specifying its unique identifier (PK, primary key).
Request data format
Request URL parameters:
Parameter | Type | Notes |
---|---|---|
ApiKey | string | Your API key, required for authentication. Required. |
TableName | string | Name of Data Table. Required. |
PrimaryKeyColumns | complex | Collection of Column elements. Contains unique identifier (PK, primary key) of the row that is supposed to be updated. This is an equivalent of SQL “WHERE” directive. Required. |
Column element children:
Parameter | Type | Notes |
---|---|---|
Name | string | Column name. Required. |
Value | string | Field value. Required. |
Examples
Request (deleting a record from table with simple PK):
POST https://api.esv2.com/v2/Api/DataTablesDeleteRow/ 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>
<PrimaryKeyColumns>
<Column>
<Name>Id</Name>
<Value>1</Value>
</Column>
</PrimaryKeyColumns>
</ApiRequest>
OK response:
HTTP/1.1 204 No Content
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>No row matching specified criteria was found.</Message>
</ErrorMessage>
</ApiResponse>
Request (deleting a record from table with composite/multicolumn PK):
POST https://api.esv2.com/v2/Api/DataTablesDeleteRow/ HTTP/1.1
Accept-Encoding: gzip,deflate
User-Agent: Jakarta Commons-HttpClient/3.1
Host: api.esv2.com
Content-Length: 321
<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>
<PrimaryKeyColumns>
<Column>
<Name>Column1</Name>
<Value>1</Value>
</Column>
<Column>
<Name>Column2</Name>
<Value>value2</Value>
</Column>
</PrimaryKeyColumns>
</ApiRequest>