Freigeben über


2.2.6.2.2.3 Entity Type (as an Atom Entry Element) with Functions

Applies to the OData 3.0 protocol

In the OData 3.0 protocol, it is possible to advertise the availability of functions (section 2.2.1.4) that are bindable to an entity.

Functions that the server advertises MUST be encoded in an m:function element under the atom:entry element that corresponds to the entity that the function is bound to. Any number of functions can be bound to the entity, and therefore, there can be an arbitrary number of m:function elements.

The m:function element MUST have a metadata attribute that contains the Function Metadata URL (section 2.2.1.4.1). The function metadata URL MUST identify only functions that are bindable to the current EntityType. If overloads exist that cannot be bound to the current EntityType, individual m:Function elements SHOULD be returned that each have a function metadata URL that identifies a specific bindable overload.

The m:function element MUST have a target attribute that contains a URL. This is the URL to which clients issue an Invoke Function request (section 2.2.7.5.2) if they want to invoke the function. The binding parameter is assumed to be bound to the encompassing EntityType. Therefore, if the client invokes the function via the target URL, it MUST not include a value for the binding parameter in the request via a parameter that is appended to the target URL.

The m:function element MUST have a title attribute that contains a simple string that is used as a simple but not necessarily unique name for the action. Generally, servers SHOULD specify a title that is easily understood by the user because the title is likely to be used by clients to display options to an end user.

If a function to be advertised has overloads, the server SHOULD if possible expose a single m:function element with a metadata attribute that identifies all the overloads bindable to the current entity.

Functions and function groups can also be selectively requested or omitted by using different Select system query option (section 2.2.3.6.1.11) combinations. If the Atom Entry Element is retrieved as part of a feed (section 2.2.6.2.1) and it is expensive to identify whether a function requested explicitly by using a Select system query option (section 2.2.3.6.1.11) is available, a server SHOULD advertise the requested function and fail later if the function is invoked and found to be unavailable.