執行實體群組交易

資料表服務支援在位於相同資料表且屬於相同資料分割群組的實體上進行批次交易。 單一交易支援多個 插入實體更新實體合併實體刪除實體插入或取代實體,以及 插入或合併實體 作業。

實體群組交易的需求

實體群組交易必須符合下列需求:

  • 交易中要執行作業的所有實體必須具有相同的 PartitionKey 值。

  • 實體在交易中只能出現一次,且只能對其執行一項作業。

  • 交易最多可以包含 100 個實體,而且其總承載的大小可能不超過 4 MiB。

  • 所有實體都受限於 瞭解資料表服務資料模型中所述的限制。

表格服務支援 OData 批次要求

實體群組交易的語意是由 OData 通訊協定規格所定義。 OData 規格定義下面批次要求的概念:

  • 「變更集」(Change Set) 是一個或多個插入、更新或刪除作業的群組。

  • 「批次」(Batch) 是作業的容器,包含一個或多個變更集和查詢作業。

表格服務支援由 OData 規格所定義的功能子集:

  • 表格服務在一個批次內僅支援一個變更集。 變更集可包含多項插入、更新及刪除作業。 如果批次包含多個變更集,服務會處理第一個變更集並拒絕其他變更集,然後顯示狀態碼 400 (不正確的要求)。

重要

一個變更集內不允許對單一實體執行多項作業。

  • 請注意,包含插入、更新或刪除作業的批次內不允許查詢作業,您必須單獨分批提交。

  • 變更集中的作業會以不可分割方式處理,換句話說,變更集中的所有作業不是全部成功,就是全部失敗。 這些作業會依照在變更集中指定的順序進行處理。

  • 表格服務在變更集中不支援執行連結作業。

  • 表格服務在變更集中最多支援 100 項作業。

透過 REST 的實體群組交易

下列各節說明如何建構批次要求及如何解譯批次回應,並分別提供一個示範。

批次要求語法

若要透過 REST 執行批次要求,請在要求 URI 上指定 $batch 選項。 例如:

https://myaccount.table.core.windows.net/$batch  

請注意,要求 URI 不包含資料表名稱。

批次要求使用單一 POST 指示詞傳送至伺服器。 此要求必須包含 x-ms-version 標頭,且標頭的值必須設為 2009-04-14 或更新版本。

XML 裝載是含有批次和變更集的多重部分 MIME 訊息。 此裝載包含兩個 MIME 界限:

  • 批次界限包含變更集。

  • 變更集界限分隔批次中的個別插入、更新及刪除作業。

變更集中的個別要求與呼叫作業本身時所提出的要求相同。 例如:

  • 若要指定更新、合併或刪除作業的 If-Match 標頭,請在變更集將此標頭加入適當作業的一組要求標頭。

  • 若要為變更集中的每個作業指定承載格式 (JSON 或 ATOM) ,請包含適當的 Content-TypeAcceptVersionDataServiceVersion 標頭,如 資料表服務作業承載格式中所述。

  • 若要隱藏 Insert 實體的回應內容回應,請使用變更集中每個插入作業的值來指定 Prefer 標頭 return-no-content 。 如需標頭的詳細資訊 Prefer ,請參閱 資料表服務功能的摘要

插入、更新及刪除作業的範例要求

下列範例顯示包含兩個 插入實體 作業和 合併實體 作業的批次要求。 在這些範例中,因為我們對插入作業的回應中的回應承載不感興趣,所以我們會包含 Prefer:``return-no-content 標頭。

注意

JSON 是建議的承載格式,也是 2015-12-11 版和更新版本唯一支援的格式。

JSON (2013-08-15 版和更新版本)

下列範例顯示具有 JSON 承載的批次要求。

  
POST https://myaccount.table.core.windows.net/$batch HTTP/1.1  
x-ms-version: 2013-08-15  
Accept-Charset: UTF-8  
DataServiceVersion: 3.0;  
MaxDataServiceVersion: 3.0;NetFx  
Content-Type: multipart/mixed; boundary=batch_a1e9d677-b28b-435e-a89e-87e6a768a431  
x-ms-date: Mon, 14 Oct 2013 18:25:49 GMT  
Authorization: SharedKey myaccount:50daR38MtfezvbMdKrGJVN+8sjDSn+AaA=  
Host: 127.0.0.1:10002  
Content-Length: 1323  
Connection: Keep-Alive  
  
--batch_a1e9d677-b28b-435e-a89e-87e6a768a431  
Content-Type: multipart/mixed; boundary=changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
POST https://myaccount.table.core.windows.net/Blogs HTTP/1.1  
Content-Type: application/json  
Accept: application/json;odata=minimalmetadata  
Prefer: return-no-content  
DataServiceVersion: 3.0;  
  
{"PartitionKey":"Channel_19", "RowKey":"1", "Rating":9, "Text":".NET..."}  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
POST https://myaccount.table.core.windows.net/Blogs HTTP/1.1  
Content-Type: application/json  
Accept: application/json;odata=minimalmetadata  
Prefer: return-no-content  
DataServiceVersion: 3.0;  
  
{"PartitionKey":"Channel_17", "RowKey":"2", "Rating":9, "Text":"Azure..."}  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
MERGE https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_17', RowKey='3') HTTP/1.1  
Content-Type: application/json  
Accept: application/json;odata=minimalmetadata  
DataServiceVersion: 3.0;  
  
{"PartitionKey":"Channel_19", "RowKey":"3", "Rating":9, "Text":"PDC 2008..."}  
  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977--  
--batch_a1e9d677-b28b-435e-a89e-87e6a768a431  
  
Atom 摘要 (2015-12-11 之前的版本)

下列範例顯示具有 Atom 承載的批次要求。

POST /$batch HTTP/1.1  
User-Agent: Microsoft ADO.NET Data Services  
x-ms-version: 2013-08-15  
x-ms-date: Thu, 30 Aug 2013 20:45:13 GMT  
Authorization: SharedKeyLite myaccount:asOEzsCDS7YEe6oi+bx47KMwbXL0lYZCOlR/oc3FReQ=  
Accept: application/atom+xml,application/xml  
Accept-Charset: UTF-8  
DataServiceVersion: 1.0;NetFx  
MaxDataServiceVersion: 2.0;NetFx  
Content-Type: multipart/mixed; boundary=batch_a1e9d677-b28b-435e-a89e-87e6a768a431  
Host: MyHostName:10002  
Prefer: return-no-content  
Content-Length: ###  
  
--batch_a1e9d677-b28b-435e-a89e-87e6a768a431  
Content-Type: multipart/mixed; boundary=changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
POST https://myaccount.table.core.windows.net/Blogs HTTP/1.1  
Content-ID: 1  
Content-Type: application/atom+xml;type=entry  
Content-Length: ###  
  
<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="https://www.w3.org/2005/Atom">  
  <title />  
  <author>  
    <name />  
  </author>  
  <id />  
  <content type="application/xml">  
    <m:properties>  
      <d:PartitionKey>Channel_19</d:PartitionKey>  
      <d:RowKey>1</d:RowKey>  
      <d:Rating m:type="Edm.Int32">9</d:Rating>  
      <d:Text>.NET...</d:Title>  
    </m:properties>  
  </content>  
</entry>  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
POST https://myaccount.table.core.windows.net/Blogs HTTP/1.1  
Content-ID: 2  
Content-Type: application/atom+xml;type=entry  
Prefer: return-no-content  
Content-Length: ###  
  
<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="https://www.w3.org/2005/Atom">  
  <title />  
  <author>  
    <name />  
  </author>  
  <id />  
  <content type="application/xml">  
    <m:properties>  
      <d:PartitionKey>Channel_19</d:PartitionKey>  
      <d:RowKey>2</d:RowKey>  
      <d:Rating m:type="Edm.Int32">9</d:Rating>  
      <d:Text>Azure...</d:Title>  
    </m:properties>  
  </content>  
</entry>  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
MERGE https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19', RowKey='3') HTTP/1.1  
Content-ID: 3  
Content-Type: application/atom+xml;type=entry  
Content-Length: ###  
  
<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="https://www.w3.org/2005/Atom">  
  <title />  
  <author>  
    <name />  
  </author>  
  <id>https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='3')</id>  
  
  <content type="application/xml">  
    <m:properties>  
      <d:PartitionKey>Channel_19</d:PartitionKey>  
      <d:RowKey>3</d:RowKey>  
      <d:Rating m:type="Edm.Int32">9</d:Rating>  
      <d:Text>PDC 2008...</d:Title>  
    </m:properties>  
  </content>  
</entry>  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977--  
--batch_a1e9d677-b28b-435e-a89e-87e6a768a431—  
  

查詢的範例要求

下列範例顯示查詢的批次要求。 請注意,變更集中只能包含一個查詢。

注意

JSON 是建議的承載格式,也是 2015-12-11 版和更新版本唯一支援的格式。

JSON (2013-08-15 版和更新版本)

下列範例顯示具有 JSON 承載的批次要求。

POST https://myaccount.table.core.windows.net/$batch HTTP/1.1  
x-ms-version: 2013-08-15  
Accept-Charset: UTF-8  
DataServiceVersion: 3.0;  
MaxDataServiceVersion: 3.0;NetFx  
Content-Type: multipart/mixed; boundary=batch_f351702c-c8c8-48c6-af2c-91b809c651ce  
x-ms-date: Mon, 14 Oct 2013 19:03:55 GMT  
Authorization: SharedKey testaccount1:y6TxCsXeRiR4l1KqihwRJ05Qb5zBk=  
Host: 127.0.0.1:10002  
Content-Length: 255  
Connection: Keep-Alive  
  
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
GET https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='2') HTTP/1.1  
Accept: application/json;odata=minimalmetadata  
  
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce  
  
Atom 摘要 (2015-12-11 之前的版本)

下列範例顯示具有 Atom 承載的批次要求。

POST /$batch HTTP/1.1  
User-Agent: Microsoft ADO.NET Data Services  
x-ms-version: 2013-08-15  
x-ms-date: Thu, 30 Aug 2013 20:45:13 GMT  
Authorization: SharedKeyLite myaccount:asOEzsCDS7YEe6oi+bx47KMwbXL0lYZCOlR/oc3FReQ=  
Accept: application/atom+xml,application/xml  
Accept-Charset: UTF-8  
DataServiceVersion: 3.0;NetFx  
MaxDataServiceVersion: 3.0;NetFx  
Content-Type: multipart/mixed; boundary=batch_f351702c-c8c8-48c6-af2c-91b809c651ce  
Content-Length: ###  
  
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
GET https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='2') HTTP/1.1  
  
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce—  
  

批次回應語法

回應會傳回批次要求的整體狀態碼,以及變更集中每項作業的個別狀態碼和結果片段。 回應是含有批次界限和變更集界限的多重部分 MIME 訊息。

表格服務會根據其成功或失敗,傳回整個批次要求的狀態碼,以及變更集中作業的一個或多個狀態碼。

假設批次要求已正確授權,而且資料表服務已成功收到,則批次要求會傳回狀態碼 202 (已接受) ,即使變更集中的其中一個作業失敗也一樣。 如果批次要求本身為失敗,那麼在執行變更集中的任何作業之前便會失敗。 例如,批次要求可能會因為授權錯誤而失敗,在此情況下,狀態碼會指出失敗。

變更集中的作業會以不可分割方式處理,換句話說,批次中的所有作業不是全部成功,就是整個批次失敗。 表格服務會繼續處理變更集中的作業,直到其中一項作業失敗為止。 如果作業失敗,批次中先前執行的所有作業都會回復。 此外,實體群組交易會在快照集隔離的情況下執行。

變更集中個別作業的狀態碼會出現在變更集回應裡。 當個別作業失敗時,變更集的回應會標示狀態碼 400 (Bad Request)。 回應中的其他錯誤資訊會透過傳回作業的索引,標示失敗的作業。 索引是裝載中的命令序號。

如需範例,請參閱下列範例錯誤回應。

建立、更新及刪除作業的範例回應

下列範例顯示針對上述範例要求中所傳送之批次作業的回應。

JSON (2013-08-15 版和更新版本)

下列範例顯示 JSON 承載所提出要求的回應。

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Content-Type: multipart/mixed; boundary=batchresponse_e69b1c6c-62ff-471e-ab88-9a4aeef0a880  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: ed9c96eb-9473-4fd9-abf6-fa4dcf0d6295  
x-ms-version: 2013-08-15  
X-Content-Type-Options: nosniff  
Date: Mon, 14 Oct 2013 18:25:49 GMT  
Content-Length: 1647  
  
--batchresponse_e69b1c6c-62ff-471e-ab88-9a4aeef0a880  
Content-Type: multipart/mixed; boundary=changesetresponse_a6253244-7e21-42a8-a149-479ee9e94a25  
  
--changesetresponse_a6253244-7e21-42a8-a149-479ee9e94a25  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 1  
X-Content-Type-Options: nosniff  
Cache-Control: no-cache  
Preference-Applied: return-no-content  
DataServiceVersion: 3.0;  
Location: https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='1')  
DataServiceId: https://myaccount.table.core.windows.net/Blogs (PartitionKey='Channel_19',RowKey='1')  
ETag: W/"0x8D101F7E4B662C4"  
  
--changesetresponse_a6253244-7e21-42a8-a149-479ee9e94a25  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 2  
X-Content-Type-Options: nosniff  
Cache-Control: no-cache  
Preference-Applied: return-no-content  
DataServiceVersion: 3.0;  
Location: https://myaccount.table.core.windows.net/Blogs (PartitionKey='Channel_19',RowKey='2')  
DataServiceId: https://myaccount.table.core.windows.net/Blogs (PartitionKey='Channel_19',RowKey='2')  
ETag: W/"0x8C134F7A4B692D8"  
  
--changesetresponse_a6253244-7e21-42a8-a149-479ee9e94a25  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 3  
X-Content-Type-Options: nosniff  
Cache-Control: no-cache  
DataServiceVersion: 1.0;  
ETag: W/"0x8A541B7C4D699D7"  
  
--changesetresponse_a6253244-7e21-42a8-a149-479ee9e94a25--  
--batchresponse_e69b1c6c-62ff-471e-ab88-9a4aeef0a880--  
  
Atom 摘要 (2015-12-11 之前的版本)

下列範例顯示使用 Atom 承載提出之要求的回應。

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Transfer-Encoding: chunked  
Content-Type: multipart/mixed; boundary=batchresponse_dc0fea8c-ed83-4aa8-ac9b-bf56a2d46dfb  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: b4b49b3e-19a9-4091-a280-da76a09da8d4  
Date: Thu, 30 Aug 2013 20:44:09 GMT  
  
334  
batchresponse_dc0fea8c-ed83-4aa8-ac9b-bf56a2d46dfb   
Content-Type: multipart/mixed; boundary=--changesetresponse_8a28b620-b4bb-458c-a177-0959fb14c977  
  
--changesetresponse_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 1  
Cache-Control: no-cache  
Preference-Applied: return-no-content  
ETag: W/"0x8D101F7E4B662C4"  
Location: https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='1')  
DataServiceVersion: 3.0;  
  
--changesetresponse_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 2  
Cache-Control: no-cache  
Preference-Applied: return-no-content  
ETag: W/"0x8C134F7A4B692D8"  
Location: https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='2')  
DataServiceVersion: 3.0;  
  
--changesetresponse_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 204 No Content  
Content-ID: 3  
Cache-Control: no-cache  
ETag: W/"0x8A541B7C4D699D7"  
DataServiceVersion: 3.0;  
  
--changesetresponse_8a28b620-b4bb-458c-a177-0959fb14c977--  
--batchresponse_4c637ba4-b2f8-40f8-8856-c2d10d163a83--  

查詢的範例回應

下列範例顯示針對上述範例要求中所傳送之查詢的回應。

JSON (2013-08-15 版和更新版本)

下列範例顯示 JSON 承載所提出要求的回應。

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Content-Type: multipart/mixed; boundary=batchresponse_0a568496-fb38-4a83-9984-5908d7f4c63d  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: 6f2aafa3-19e9-434c-85f2-d178941c2d4b  
x-ms-version: 2013-08-15  
X-Content-Type-Options: nosniff  
Date: Mon, 14 Oct 2013 19:13:30 GMT  
Content-Length: 615  
  
--batchresponse_0a568496-fb38-4a83-9984-5908d7f4c63d  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 200 OK  
DataServiceVersion: 3.0;  
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8  
X-Content-Type-Options: nosniff  
Cache-Control: no-cache  
ETag: W/"0x5B168C7B6E589D2"  
  
{"odata.metadata":" https://myaccount.table.core.windows.net/Blogs/$metadata#Blogs/@Element","PartitionKey":"Channel_19","RowKey":"2","Timestamp":"2013-10-14T18:25:49.8922467Z","Rating":9,"Text":"Azure..."}  
--batchresponse_0a568496-fb38-4a83-9984-5908d7f4c63d--  
Atom 摘要 (2015-12-11 之前的版本)

下列範例顯示使用 Atom 承載提出之要求的回應。

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Transfer-Encoding: chunked  
Content-Type: multipart/mixed; boundary=batchresponse_4c637ba4-b2f8-40f8-8856-c2d10d163a83  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: 9202c4a1-43af-4dc0-baca-aa71f7a7407b  
Date: Thu, 30 Aug 2013 20:44:10 GMT  
  
--batchresponse_4c637ba4-b2f8-40f8-8856-c2d10d163a83  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 200 OK  
Content-Type: application/atom+xml;charset=utf-8  
Cache-Control: no-cache  
ETag: W/"0x5B168C7B6E589D2"  
DataServiceVersion: 3.0;  
  
<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<entry xml:base="http://127.0.0.1:10002/testaccount1/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:etag="W/"0x5B168C7B6E589D2"" xmlns="https://www.w3.org/2005/Atom">  
    <id> https://myaccount.table.core.windows.net/Blogs(PartitionKey='Channel_19',RowKey='1')</id>  
  <title type="text"></title>  
  <updated>2013-08-30T20:44:10Z</updated>  
  <author>  
    <name />  
  </author>  
  <link rel="edit" title="Blogs" href=" Blogs(PartitionKey='Channel_19',RowKey='2')" />  
  <category term="myaccount.Blogs" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  <content type="application/xml">  
    <m:properties>  
      <d:PartitionKey>Channel_19</d:PartitionKey>  
       <d:RowKey>2</d:RowKey>  
       <d:Timestamp m:type="Edm.DateTime">2013-08-30T20:44:09.5789464Z</d:Timestamp>  
       <d:Text>.Net...</d:RowKey>  
      <d:Rating m:type="Edm.Int32">9</d:Rating>  
    </m:properties>  
  </content>  
</entry>  
--batchresponse_4c637ba4-b2f8-40f8-8856-c2d10d163a83--  
  

範例錯誤回應

下列範例顯示針對含有失敗作業之批次要求所做的回應。 請注意,批次回應會傳回狀態碼 202 (已接收),但失敗的個別作業則會傳回狀態碼 400 (不正確的要求)。 其他錯誤資訊會包含在失敗作業的回應主體中。 code 項目指定儲存體服務錯誤碼,而 message 項目的開頭為失敗作業的索引,後面接著錯誤訊息字串。 若要判斷哪項作業失敗,請剖析訊息中的索引值。 作業會從零開始編製索引。

JSON 格式要求的錯誤回應

在 JSON 範例中,請注意失敗的作業為變更集中的第一項作業。 在 message 名稱/值組中,訊息的開頭為數字 0,後面接著擴充的錯誤資訊。

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Content-Type: multipart/mixed; boundary=batchresponse_4e1c04af-af2b-4cfc-9e35-7677a5efcfca  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: 8abd3c55-a72e-47ba-ae0b-ba43abeb76ae  
x-ms-version: 2013-08-15  
X-Content-Type-Options: nosniff  
Date: Mon, 14 Oct 2013 19:21:58 GMT  
Content-Length: 1051  
  
--batchresponse_4e1c04af-af2b-4cfc-9e35-7677a5efcfca  
Content-Type: multipart/mixed; boundary=changesetresponse_e2a26601-bba8-4c1a-8a8c-bb66badcbca1  
  
--changesetresponse_e2a26601-bba8-4c1a-8a8c-bb66badcbca1  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 400 Bad Request  
Content-ID: 1  
X-Content-Type-Options: nosniff  
DataServiceVersion: 3.0;  
Content-Type: application/json;odata=minimalmetadata;streaming=true;charset=utf-8  
  
{"odata.error":{"code":"OutOfRangeInput","message":{"lang":"en-US","value":"0:One of the request inputs is out of range.\nRequestId:8abd3c55-a72e-47ba-ae0b-ba43abeb76ae\nTime:2013-10-14T19:21:58.0890048Z}}}  
--changesetresponse_e2a26601-bba8-4c1a-8a8c-bb66badcbca1--  
--batchresponse_4e1c04af-af2b-4cfc-9e35-7677a5efcfca--  
  
Atom 格式要求的錯誤回應

在 Atom 範例中,請注意失敗的作業為變更集中的第四項作業。 在 message 項目中,訊息的開頭為數字 3,後面接著擴充的錯誤資訊。

<message xml:lang="en-US">3:One of the request inputs is not valid.</message>  

以下是完整的回應:

HTTP/1.1 202 Accepted  
Cache-Control: no-cache  
Transfer-Encoding: chunked  
Content-Type: multipart/mixed; boundary=batchresponse_7ab1553a-7dd6-44e7-8107-bf1ea1ab1876  
Server: Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0  
x-ms-request-id: 45ac953e-a4a5-42ba-9b4d-97bf74a8a32e  
Date: Thu, 30 Apr 2009 20:45:13 GMT  
  
6E7  
--batchresponse_7ab1553a-7dd6-44e7-8107-bf1ea1ab1876  
Content-Type: multipart/mixed; boundary=changesetresponse_6cc856b4-8cb9-41eb-b8d2-bb73475c6cec  
  
--changesetresponse_6cc856b4-8cb9-41eb-b8d2-bb73475c6cec  
Content-Type: application/http  
Content-Transfer-Encoding: binary  
  
HTTP/1.1 400 Bad Request  
Content-ID: 4  
Content-Type: application/xml  
Cache-Control: no-cache  
DataServiceVersion: 1.0;  
  
<?xml version="1.0" encoding="utf-8" standalone="yes"?>  
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">  
  <code>InvalidInput</code>  
  <message xml:lang="en-US">3:One of the request inputs is not valid.</message>  
</error>  
--changesetresponse_6cc856b4-8cb9-41eb-b8d2-bb73475c6cec--  
--batchresponse_7ab1553a-7dd6-44e7-8107-bf1ea1ab1876--  
  

另請參閱

OData 規格
資料表服務概念