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

What should be returned for inserted non-entity value?

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_CS01
    • Fix Version/s: V4.01_CS02
    • Component/s: Protocol
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      1) We shouldn't have different behavior for ordered versus non-ordered collections.
      2) Inserting into a non-entity collection (in general) isn't creating a resource, so 201 is not appropriate, which resolves the issue of the location and entity-id headers.
      3) By default, we should return 204, no content (and no body)
      4) If we support the return=representation header, we should return the updated collection.

      Show
      1) We shouldn't have different behavior for ordered versus non-ordered collections. 2) Inserting into a non-entity collection (in general) isn't creating a resource, so 201 is not appropriate, which resolves the issue of the location and entity-id headers. 3) By default, we should return 204, no content (and no body) 4) If we support the return=representation header, we should return the updated collection.
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/64119/odata-v4.01-wd06-part1-protocol-2018-10-19.docx  

      Description

      In ODATA-616 we introduced the ability to post to a collection of non-entity types. The new wording appears in [Section 11.4.9.4, Update a Collection Property, of Protocol](http://docs.oasis-open.org/odata/odata/v4.01/cs01/part1-protocol/odata-v4.01-cs01-part1-protocol.html#_Toc505771257):

      A successful POST request to the edit URL of a collection property adds an item to the collection. The body of the request MUST be a single item to be added to the collection. If the collection is ordered, the item is added to the end of the collection, and $index MAY be used to specify a zero-based ordinal position to insert the new value, with a negative value indicating an ordinal position from the end of the collection.

      And later, we say:

      On success, the response MUST be a valid update response.

      However, we don't say what response code, or body, to return for this case.

      For a created entity, we would typically return 201 Created and the newly created resource in the body, unless the return=minimal preference was applied, in which case we would return 204. But 201 Created requires a Location header (and, in OData, an Entity-id header). So, if we return 201, what would we return for the location (and entity-id) headers?

      Does it matter whether the collection is ordered (in which case we have a location for the added resource)?

      Or, perhaps we always return 204, no content (and no body)?

      Or do we view this as an update and return 200, along with the newly inserted value? Or 200 with the full collection? Or 200 with the entity containing (at least?) the populated collection?

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mikep Michael Pizzo
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: