oData v4 what are Functions and Actions in simple terms?

user576510 picture user576510 · Jun 29, 2016 · Viewed 7.9k times · Source

In oData 4.0 Actions and functions are frequently referred. I couldn't get what are they and how they are different. Are function same functions we have in any programming language or something else ? What are Actions ? and how both are different. Thanks for your help.

Answer

Vinit picture Vinit · Jun 29, 2016

Actions - Can be used to perform CRUD operations on an entity. That means , you can create,update,delete the entity using custom actions if default actions (POST/PUT/DELETE) doesn't support your requirements. Also you can use the custom actions to fetch the data from multiple entities for complex types. Actions are similar to Stored procedures in SQL which allows SELECT as well as DML queries.

Functions - Ideally, you should use functions to get data only and not for data modifications. These are similar to functions in SQL which allows SELECT queries only.