Przejdź do treści

Update row

DataTablesUpdateRow allows updating existing rows using HTTP POST method. It is only possible to update a single row with one request by specifiying its unique identifier (PK, primary key).

Request data format

ApiRequest element children:

ParameterTypeNotes
ApiKeystringYour API key, required for authentication. Required.
TableNamestringName of Data Table. Required.
PrimaryKeyColumnscomplexCollection 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.
ColumnscomplexCollection of Column elements. Contains information about columns that are supposed to be updated and their new values. This is an equivalent of SQL „SET” directive. Required.

Column element children:

ParameterTypeNotes
NamestringColumn name. Required.
ValuestringField value. Required.

Examples

Request:

POST https://api.esv2.com/v2/Api/DataTablesUpdateRow/ 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>Column1</Name>
       <Value>1</Value>
     </Column>
   </PrimaryKeyColumns>
   <Columns>
     <Column>
       <Name>Column2</Name>
       <Value>2</Value>
     </Column>
     <Column>
       <Name>Column3</Name>
       <Value>Value1</Value>
     </Column>
   </Columns>
</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>