OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [OASIS Issue Tracker] (ODATA-1505) Expressions in action payloads


Heiko Theissen created ODATA-1505:
-------------------------------------

             Summary: Expressions in action payloads
                 Key: ODATA-1505
                 URL: https://issues.oasis-open.org/browse/ODATA-1505
             Project: OASIS Open Data Protocol (OData) TC
          Issue Type: Improvement
          Components: JSON Format
            Reporter: Heiko Theissen


h2. Use case

The history of department D15 (example data from [OData-Temporal]) shall be merged into D08. Assume we already have a function {{toTimeslices}}Âthat converts {{Departments('D15')/history}}Âinto the {{TimesliceWithPeriod}} format so that
{code:java}
GET ~/Departments('D15')/history/Temporal.toTimeslices()
{code}
returns
{code:json}
[{"Timeslice":Â{
 Â "From":Â"2010-01-01",
ÂÂÂ"To":Â"2011-01-01",
 "Name": "Services",
ÂÂÂ"Budget":Â1100
}},
 {"Timeslice":Â{
ÂÂÂ"From":Â"2011-01-01",
ÂÂÂ"To":Â"9999-12-31",
ÂÂÂ"Name":Â"Services",
ÂÂÂ"Budget":Â1700
}}]
{code}
If action parameters were specified in the URL, one could write:
{code:java}
POSTÂ~/Departments('D08')/history/Temporal.Update(deltaTimeslices=@delta)
&@delta=$root/Departments('D15')/history/Temporal.toTimeslices()
{code}
But action parameters must be passed in the payload, and this does not allow aliases and expressions.
h2. Suggestion
{code:java}
POSTÂ~/Departments('D08')/history/Temporal.Update

{
 "deltaTimeslices@expressionUrl":
 "$root/Departments('D15')/history/Temporal.toTimeslices()"
}
{code}
Or, because in a structured payload, a structured expression fits better than an expression string that must be parsed, we borrow notation from [CSDL|https://docs.oasis-open.org/odata/odata-csdl-json/v4.01/odata-csdl-json-v4.01.html#sec_ApplyClientSideFunctions]:
{code:java}
POSTÂ~/Departments('D08')/history/Temporal.Update

{
Â"deltaTimeslices@expressionCsdl": {
  "$Function": "Temporal.toTimeslices",
  "$Apply": [
   {"$Path": "$root/Departments('D15')/history"}
  ]
 }
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.3#803004)


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]