4.9 Invoking a Function

To invoke a function, a client sends an HTTP GET request to the URL that represents the function. Binding allows the client to send the GET request to a URL that represents the function with the binding parameter that is already specified.

In the following example, the binding parameter (called "Customer"; see section 6) to the HasOrderFor function is the resource identified by the URL preceding the fully-qualified function name. In this example, the remaining parameters (productType) are specified in the query string according to the rules specified in section 2.2.7.5.2.

In this example, the request asked for a response formatted in Verbose JSON, so the Boolean return value for this function is returned in a standard OData Verbose JSON response, with a name/value pair, where the name is the name of the function and value is returnType serialized in OData Verbose JSON format.

HTTP Request:

        GET /Customers('ALFKI')/SampleEntities.HasOrderFor?productType='luxury goods' HTTP/1.1
        Host: host
        Accept: application/json;odata=verbose
        DataServiceVersion: 3.0
        MaxDataServiceVersion: 3.0

HTTP Response:

        HTTP/1.1 200 OK
        Date: Fri, 11 Oct 2008 04:23:49 GMT
        DataServiceVersion: 3.0
         {
             "d" : {
               "HasOrderFor": true
             }
          }