web-servicesodataasp.net-web-apidataservice

OData WebAPI vs Simple WebAPI


What is the difference between them? For example if I create a Web API controller in Visual Studio how is it different from Web API OData controller? So basically, what is the difference between web services and data services?

Thanks.


Solution

  • WebAPI is a technology used to build web services. OData is a protocol for web services that describes how some of the functionality of those web services should work.

    There is an implementation of OData for WebAPI that gives you a lot of the OData protocol for very little work.

    How is it different from Web API OData controller?

    An OData controller is a WebAPI controller but with a few other bits and pieces to enable the OData protocol, this includes inheriting from a different base controller and a few attributes. You can find lots of guides on how to create an OData controller online if you want to see the specific details. There are even a few "how to convert a WebAPI controller to an OData controller" around too.

    What is the difference between web services and odata services?

    OData services are web services but with certain behaviour enforced on them, for example, the ability to filter and sort the results and to navigate relationships among other thing. Again, details on these are available online so I won't add any here but hopefully you get the idea.