Follow these steps to create a WebApi OData service for your Orchard Blogs
  • download the Orchard.OData module source code http://orchardodata.codeplex.com/downloads/get/595551 and add it under your modules folder.
  • create a new module ODataBlog and
    • add a reference to Orchard.OData module and to Orchard.Blogs.
    • add a reference to System.Net.Http, System.Net.Http.Formatting and System.Web.Http from the orchard/lib/aspnetwebapi folder of your latest orchard distribution
    • add a reference to System.Web.Http.OData from the Orchard.Odata/Libs folder
    • add a reference to System.Runtime.Serialization (4.0 .Net Framework)
  • create a Blog.cs model for your blogs that it is serializable ODataBlog Model
  • create the BlogController.cs that is going to serve the requests ODataBlog Controller
  • create a Routes.cs file and add your routes to handle OData requests ODataBlog Routes

working examples on azure cloud service
http://www.grapto.com/v1/channels
http://www.grapto.com/v1/channels?$format=json
http://www.grapto.com/v1/channels?$skip=5&$format=json
http://www.grapto.com/v1/channels?$orderby=Title&$format=json
http://www.grapto.com/v1/channels/333?$format=json
http://www.grapto.com/v1/channels/333/preview?$format=json

Last edited Aug 31, 2013 at 5:23 PM by fotisgpap, version 13

Comments

No comments yet.