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

If-Then-Else in $batch requests

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.01_CSD02
    • Fix Version/s: V4.01_CS02
    • Component/s: JSON Format, Vocabularies
    • Labels:
      None
    • Environment:

      Applied

    • Proposal:
      Hide

      Add an optional "if" member to request objects that allows specifying a condition for executing the request depending on the outcome of preceding requests. 

      The value of "if" is a string containing a boolCommonExpr as in $filter that can reference preceding requests listed in "dependsOn". It replaces the default condition of "all preceding requests listed in dependsOn have succeeded".

      Filter expression syntax is extended, additional expressions are

      • $<content-id>/$succeeded to check if the referenced request succeeded 
      • $<content-id> to reference the response body
      • $<content-id>/<path> to reference a part of the response body

      Define new property RequestDependencyConditionsSupported ConditionalRequestsSupported for Capabilities.BatchSupportType to advertise this new capability.

      If a service does not support "if" the conditional request MUST fail and if the conditional request is part of an atomicity group, that group fails and is rolled back.

      Show
      Add an optional "if" member to request objects that allows specifying a condition for executing the request depending on the outcome of preceding requests.  The value of "if" is a string containing a boolCommonExpr as in $filter that can reference preceding requests listed in "dependsOn". It replaces the default condition of "all preceding requests listed in dependsOn have succeeded". Filter expression syntax is extended, additional expressions are $<content-id>/$succeeded  to check if the referenced request succeeded  $<content-id>  to reference the response body $<content-id>/<path> to reference a part of the response body Define new property RequestDependencyConditionsSupported ConditionalRequestsSupported for Capabilities.BatchSupportType to advertise this new capability. If a service does not support "if" the conditional request MUST fail and if the conditional request is part of an atomicity group, that group fails and is rolled back.
    • Resolution:
      Show
      https://github.com/oasis-tcs/odata-vocabularies/pull/26 https://www.oasis-open.org/committees/download.php/64120/odata-json-format-v4.01-wd06-2018-10-19.docx  

      Description

      Add an If-Then-Else construct to batch requests that allows executing a sequence of requests depending on a condition, typically the HTTP status code of a preceding request

      Example 1:
      1. Book specific seat for a sports event
      2. if booking failed
      2.a. book best-match seat for a sports event
      endif

      Example 2:
      1. Modify shopping cart
      2. Convert shopping cart to purchase order (bound action)
      3. if success
      3.a. GET newly created purchase order
      else
      3.b. GET modified shopping cart
      endif

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: