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

Define standard client-side function for filling URL templates (RFC6570)

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: CSDL XML
    • Labels:
      None
    • Environment:

      [Proposed]

    • Proposal:
      Hide

      Define a client-side function odata.fillUriTemplate that takes two or more arguments.

      The first argument MUST be of type String and specifies the URL template, the other arguments MUST be LabeledElement expressions that specify the template parameter name and evaluate to the template parameter value.

      RFC6570 defines three kinds of template parameters: simple values, lists of values, and key-value maps.

      Simple values are represented as LabeledElement expressions that evaluate to a single primitive value. The literal representation of this value according to ODATA-ABNF is used to fill the corresponding template parameter.

      Lists of values are represented as LabeledElement expressions that evaluate to a collection of primitive values.

      Key-value maps are represented as LabeledElement expressions that evaluate to a collection of complex types with two properties that are used in lexicographic order. The first property is used as key, the second property as value.

      Define a second client-side function odata.uriEncode that takes one argument of primitive type and returns the URL encoded literal that can be used as a key value in OData URLs or in the query part of OData URLs.

      Example:
      In case you KNOW that there are no special characters in Genre names:

      <Apply Function="odata.fillUriTemplate">
      <String>http://odata.netflix.com/v2/Catalog/Genres('

      {genreName}')</String>
      <LabeledElement Name="genreName" Path="NameOfMovieGenre" />
      </Apply>


      Example:
      If you want to be on the safe side:

      <Apply Function="odata.fillUriTemplate">
      <String>http://odata.netflix.com/v2/Catalog/Genres('{genreName}

      ')</String>
      <LabeledElement Name="genreName">
      <Apply Function="odata.uriEncode" >
      <Path>NameOfMovieGenre</Path>
      </Apply>
      </LabeledElement>
      </Apply>

      We also need to make sure we reserve odata. for names of apply functions.

      Accepted: https://www.oasis-open.org/committees/download.php/48411/odata-meeting-27_on-20130228-minutes.html#odata-257

      Show
      Define a client-side function odata.fillUriTemplate that takes two or more arguments. The first argument MUST be of type String and specifies the URL template, the other arguments MUST be LabeledElement expressions that specify the template parameter name and evaluate to the template parameter value. RFC6570 defines three kinds of template parameters: simple values, lists of values, and key-value maps. Simple values are represented as LabeledElement expressions that evaluate to a single primitive value. The literal representation of this value according to ODATA-ABNF is used to fill the corresponding template parameter. Lists of values are represented as LabeledElement expressions that evaluate to a collection of primitive values. Key-value maps are represented as LabeledElement expressions that evaluate to a collection of complex types with two properties that are used in lexicographic order. The first property is used as key, the second property as value. Define a second client-side function odata.uriEncode that takes one argument of primitive type and returns the URL encoded literal that can be used as a key value in OData URLs or in the query part of OData URLs. Example: In case you KNOW that there are no special characters in Genre names: <Apply Function="odata.fillUriTemplate"> <String> http://odata.netflix.com/v2/Catalog/Genres( ' {genreName}')</String> <LabeledElement Name="genreName" Path="NameOfMovieGenre" /> </Apply> Example: If you want to be on the safe side: <Apply Function="odata.fillUriTemplate"> <String> http://odata.netflix.com/v2/Catalog/Genres( '{genreName} ')</String> <LabeledElement Name="genreName"> <Apply Function="odata.uriEncode" > <Path>NameOfMovieGenre</Path> </Apply> </LabeledElement> </Apply> We also need to make sure we reserve odata. for names of apply functions. Accepted: https://www.oasis-open.org/committees/download.php/48411/odata-meeting-27_on-20130228-minutes.html#odata-257
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/48440/odata-core-v4.0-wd01-part3-csdl-2013-03-05-RH.doc Accepted: https://www.oasis-open.org/committees/download.php/48549/odata-meeting-29_on-20130314-minutes.html#odata-257

      Description

      In mashup scenarios it is often the case that a third party can detect a rule that allows constructing URLs from information provided in an entity that allow navigation to other resources in the web.

      Annotations allow to express these construction rules via the odata.concat client-side function, but that can become tedious if the URL patterns to construct are non-trivial.

      RFC6570 (http://tools.ietf.org/html/rfc6570) defines a simple notation for URL templates and a simple set of rules on how to translate the template and a set of variable values into a URL.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: