Entity Group Transaction - delete without query (using "*" etag)

Answered Entity Group Transaction - delete without query (using "*" etag)

  • Samstag, 10. März 2012 01:44
     
     

    Is it possible to perform an entity group transaction against table storage with a delete operation using an etag of "*"?

    I am trying to delete a group of records where I know the PK and RK without having to first query for them.

    When I try this I get a 202 response but in the body I am seeing the following within the --batchresponse:

    HTTP/1.1 404 Not Found
    Content-ID: 200
    Cache-Control: no-cache
    DataServiceVersion: 1.0;
    Content-Type: application/xml

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <code>ResourceNotFound</code>
      <message xml:lang="en-US">10:The specified resource does not exist.
    RequestId:8ca80a9e-dc43-455b-bd3a-8b5c488132f5
    Time:2012-03-10T01:35:33.3138372Z</message>
    </error>

Alle Antworten

  • Samstag, 10. März 2012 06:04
     
     

    Can you post what your request looks like? 

  • Samstag, 10. März 2012 17:30
     
     

    Below is the first part of the request. It shows up through the first two delete operations of the batch, there are 98 more in the full request (note I changed the storage account name to protect the innocent).

    POST http://mystorageacct.table.core.windows.net/$batch HTTP/1.1
    User-Agent: Microsoft ADO.NET Data Services
    DataServiceVersion: 1.0;NetFx
    MaxDataServiceVersion: 2.0;NetFx
    x-ms-version: 2011-08-18
    x-ms-date: Sat, 10 Mar 2012 17:21:47 GMT
    Authorization: SharedKeyLite mystorageacct:cXOLYYnV5VtGRkUJR9qnwpQ1Awnwzg+Cew25Y3cT+FQ=
    Accept: application/atom+xml,application/xml
    Accept-Charset: UTF-8
    Content-Type: multipart/mixed; boundary=batch_659a384c-52af-4e57-9ecb-df8317f064e7
    Host: mystorageacct.table.core.windows.net
    Content-Length: 26773
    Connection: Keep-Alive

    --batch_659a384c-52af-4e57-9ecb-df8317f064e7
    Content-Type: multipart/mixed; boundary=changeset_e7959f1a-675d-4f23-b60e-0a83ff90f2f5

    --changeset_e7959f1a-675d-4f23-b60e-0a83ff90f2f5
    Content-Type: application/http
    Content-Transfer-Encoding: binary

    DELETE http://mystorageacct.table.core.windows.net/sdkuser(PartitionKey='',RowKey='UnitTestUser0') HTTP/1.1
    Content-ID: 2
    If-Match: *

    --changeset_e7959f1a-675d-4f23-b60e-0a83ff90f2f5
    Content-Type: application/http
    Content-Transfer-Encoding: binary

    DELETE http://mystorageacct.table.core.windows.net/sdkuser(PartitionKey='',RowKey='UnitTestUser1') HTTP/1.1
    Content-ID: 4
    If-Match: *

  • Samstag, 10. März 2012 18:12
     
     Beantwortet

    OK, I figured out my own problem. I was including entities in the request that did not exist. My bad.

    But in case anyone is interested, yes you can use Entity Group Transactions to delete multiple records without querying for them first (using etag="*").

    • Als Antwort markiert Curious George Samstag, 10. März 2012 18:12
    •