2.2.3.6.4 Function Parameters

Applies to OData 3.0 protocol

Functions are represented by using FunctionImport elements, as specified in Functions (section 2.2.1.4). Functions, unlike service operations and actions, have IsSideEffecting set to "false". If a Function requires input parameters, those parameters can be passed to the function in four possible ways:

  • If the FunctionImport has IsBindable set to "true", the first (or binding) parameter MAY be provided by appending a functionCall-partiallyBound (section 2.2.3.1) to a resource path that represents that parameter value.

  • If a functionCall or functionCall-partiallyBound (URI Syntax (section 2.2.3.1)) is the last call to a function in the resource path, the function's unbound parameters MAY be specified via query string name/value pairs that are appended to the data service URI that identifies the FunctionImport, as described in Resource Path: Semantics (section 2.2.3.5). The name of each of the function's unbound parameters in the corresponding FunctionImport is used as the name in the name/value pair. All unbound parameters MUST be provided either in the query string or inline in the URI Path. Primitive type parameters MAY be specified in the resource path between the parentheses of the functionCall or functionCall-partiallyBound (URI Syntax (section 2.2.3.1)) segments.

  • Parameters, primitive or otherwise, MAY be passed by using parameter aliases (URI Syntax (section 2.2.3.1)). The aliases are introduced between the parentheses of the functionCall or functionCall-partiallyBound segments, in place of parameter values. Then the actual parameter values are specified via query string name/value pairs where the name is the alias that is introduced and the value is the parameter value provided.

  • If parameters to a functionCall or functionCall-partiallyBound segment are specified inline either directly or by using parameter aliases, the parameter names MUST be included via the functionParameterName in the functionParameter.

     ; OData 3.0 only
     functionParameter = functionParameterName
                     "="
                     ( functionParameterValue / functionParameterAlias )
                     
     functionParameterName = ; section 2.2.3.1
                          ; the name of a parameter of the final Function segment 
                          ; in the Uri path, defined in the EDM model
                          ; associated with the Data Service, specified in the URI path
      
     functionParameterAlias = ; section 2.2.3.1
                          ; the name of an alias, introduced in the URI path for a
                          ; particular parameter value, prefixed with ‘@’.   
      
     functionParameterValue = null 
                              primitiveLiteral /
                              entityTypeBody / 
                              entityCTBody / 
                              collectionInVJson / 
                              entityCollectionValueInVJson /
                              collectionInJson / 
                              entityCollectionValueInJson
                              
     null = ; section 2.2.3.1 
            ; not to be confused with nullLiteral (in JSON)
      
     entityTypeBody   =  ; section 2.2.6.3.3
      
     entityCTBody     =  ; section 2.2.6.3.4
      
     collectionInVJson = ; a Collection of ComplexTypes or PrimitiveTypes formatted 
                         ; in OData Verbose JSON format (section 2.2.6.3.3) and UrlEncoded.
      
     entityCollectionValueInVJson = ; a collection of Entities formatted in
                                    ; OData Verbose JSON format (section 2.2.6.3.2)
                                    ; and UrlEncoded.
      
     collectionInJson = ; a collection of primitive values or of complex values formatted
                        ; in JSON format as per [ODataJSON4.0] sections 7.3 and 7.4,
                        ; respectively, and UrlEncoded.
      
     entityCollectionValueInJson = ; a collection of entities formatted in JSON format
                                   ; as per [ODataJSON4.0] section 12 and UrlEncoded.
    

Listing: ABNF Grammar for Function Parameters