条目更新

Update Row 条目更新

采用 HTTP POST 方式可以更新Data table中的现有条目.

它支持一次请求更新一个单一条目.

请求数据格式

ApiRequest子元素:
参数 类型 描述
ApiKey string 你的 API key, 用于身份验证. 必填
TableName string 数据表格名称. 必填.
PrimaryKeyColumns complex 区分各个被更新条目的标识. 各个列元素值的集合 (包含多个column元素). 相当于SQL中的“WHERE”指令.必填.
Columns complex 各个列元素值的集合 (包含要更新的列名及数值). 相当于SQL中的“SET”指令.必填.

Column子元素:

参数 类型 描述
Name string 列名称. 选填.
Value string 值. 选填.
示例:
请求:
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应答:
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
错误应答:
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>