A question I have often seen is what is the difference between the various kinds of functions in OData.
Central to OData is not the ability to just query the data table via HTTP and receive the result as an XML or JSON stream, but rather allow the client to be able to execute a business process on the server much like a stored procedure does in SQL. These are called Operations.
Operation names need to be unique however the combination of entity type it operates on, the parameter names and operation name does however need to be unique.
Operations are the base for two specialized forms of operations, functions and actions. The distinction was however only clarified in OData 3.0.
There is a very clear distinction from a sematic point of view as to the differences between a function and an action which are not obvious from just looking at the metadata.
Functions must always return data and must never alter data on the backend so that there are no observable side effects to the function call. This means they are almost always GET HTTP operations. There are exceptions where the data is very large in which case a post could be utilized
Actions on the other hand are a superset of functions in that the two criteria of a function are relaxed – actions do not have to always return a result and executing the action can cause changes to the backend data. For this reason actions are performed using the POST HTTP verb to indicate a REST style create or update semantic operation. For example an action can be a business process that updates other OData entity sets and starts a workflow on the server.
Since functions are idempotent they can be used in $filter and $sortby system queries to provide a better fidelity in filtering and sorting queries.
Finally operations parameters are handled much like querying for an entity with a compound key. The parameters are wrapped in brackets in the format “name = value” seperated by a comma.