Question

I read in an article that odata can be used for different combination of clients/servers.

Say I would like to develop a web application where i store data(say information about all mobile products on market) using mongoDB and use python as backend with Bottle framework to access data through browser as GET. Then i decide to extend web app as android app. i can extend it to android without any code change on server side. My doubt is does using odata here helps in any way? Say if i want to extend it to other clients?

Était-ce utile?

La solution

Yes, you are right, you don't need to change even a single line of code on the server side if you change a client app. OData defines many conventions for the communications between the client and the server. such as:

  1. What the URL looks like if you want to query some data http://services.odata.org/V4/OData/OData.svc/Products?$filter=ID gt 2&$select=ID,Name,Rating,Price&$orderby=Price desc

  2. Which http method should be used to Create/Retrieve/Update/Delete an entity Generally speaking, Post for Create, Get for Retrieve, Patch/Put for Update, Delete for Delete.

  3. What the payload looks like.

  4. How to invoke a function/action

As long as the requests conform to these conventions, the server side always returns the predictable responsese regardless whether the clients is a browser or a mobile device.

I also find the examples for the odata: https://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/OData/v4/ .

Hope this helps you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top