Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-615

Allow PATCH and DELETE with /$filter=@... on collections to modify or delete all (and only) the matching entities

    XMLWordPrintable

    Details

    • Proposal:
      Hide

      1) DELETE to any collection deletes all elements of the collection; a $filter path segment can be used to delete only elements matching that filter. ODATA-616, ODATA-615
      2) PUT against a collection of primitive/complex types takes a collection (format is same as for a GET on the collection) in the payload and replaces the entire collection. ODATA-615 (all or nothing)
      a. PUT does not support set operations (so $filter segment doesn't apply).
      b. This is the existing 4.0 behavior
      3) PUT is not supported against an entity collection ODATA-615
      4) PATCH to any collection with a payload containing a single instance updates each element in the collection ODATA-615
      a. A $filter path segment can be used to apply the patch only to those items matching the $filter ODATA-615
      5) PATCH to a collection of primitive or complex types with a collection payload is not supported ODATA-615

      NOTE: if we supported a $expand path segment if the future we could support the ability to delete related entities (deep delete)

      Show
      1) DELETE to any collection deletes all elements of the collection; a $filter path segment can be used to delete only elements matching that filter. ODATA-616 , ODATA-615 2) PUT against a collection of primitive/complex types takes a collection (format is same as for a GET on the collection) in the payload and replaces the entire collection. ODATA-615 (all or nothing) a. PUT does not support set operations (so $filter segment doesn't apply). b. This is the existing 4.0 behavior 3) PUT is not supported against an entity collection ODATA-615 4) PATCH to any collection with a payload containing a single instance updates each element in the collection ODATA-615 a. A $filter path segment can be used to apply the patch only to those items matching the $filter ODATA-615 5) PATCH to a collection of primitive or complex types with a collection payload is not supported ODATA-615 NOTE: if we supported a $expand path segment if the future we could support the ability to delete related entities (deep delete)
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/60366/odata-v4.01-wd02-part1-protocol-2017-03-24.docx https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/4.01%20spec/ABNF/odata-abnf-construction-rules.txt?op=diff&rev=1019 https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/4.01%20spec/ABNF/odata-abnf-testcases.xml?op=diff&rev=1019

      Description

      Another natural extension

      Previous proposal:
      (was 11.4.3) 11.4.3.1 Update a Single Entity
      (add this first sentence to explain the expected request URL) To update a single entity in a collection, the client sends a PATCH or POST request to an entity's edit URL.

      11.4.3.2 Updating Multiple Entities
      To update multiple entities in a collection, the client sends a PATCH request to that collection's URL.
      The URL may include a $filter query option restricting the entities to be updated. For the entities matching the filter expression or all entities in the collection if no $filter query option was given, the service handles the request as a request to update a single entity (link to 11.4.3.1).
      On success, the response MUST be a valid success response (link to 9.1).
      On failure, the service MUST NOT update any of the qualifying entities.

      11.4.5 Deleting Entities from a Collection

      (was 11.4.5) 11.4.5.1 Delete a Single Entity

      11.4.5.2 Deleting Multiple Entities
      To delete multiple entities in a collection, the client sends a DELETE request to that collection's URL.
      The URL may include a $filter query option restricting the entities to be deleted. For the entities matching the filter expression or all entities in the collection if no $filter query option was given, the service handles the request as a request to delete a single entity (link to 11.4.5.1).
      On success, the response MUST be 204 No Content (link to 9.1.4) and contain an empty body. .
      On failure, the service MUST NOT delete any of the qualifying entities.

      part2-url-conventions

      In section "5.1 System Query Options", change the sentence "POST requests to entity sets as well as all PUT and DELETE requests do not allow system query options." to "POST and PUT requests to entity sets do not allow system query options."

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              handl Ralf Handl
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: