Sense/Net Content Repository now supports OData

Many of our users were asking for a REST API for the Sense/Net Content repository. I have good news: Sense/Net Community 6.2 now has a REST API, based on the OData standard.

OData is a data access protocol from Microsoft released under the Microsoft Open Specification Promise, so anyone can use and implement it for any purpose, for free. The protocol was designed to provide standard CRUD access of a data source via a website. OData has been submitted to OASIS.

OData follows many of the principles of REST. Representational State Transfer (REST) is a software architectural style for distributed hypermedia systems like the World Wide Web. The term was originally defined in a doctoral dissertation (Architectural Styles and the Design of Network- based Software Architectures) about the web written by Roy Fielding. We choose OData because we did not want to reinvent the wheel, and because so many libraries (such as Kendo UI) have built in support for OData.

All interactions with an OData feed are done using URIs to address resources and standard HTTP verbs (GET, POST, PUT, DELETE, etc) to act on those resources. Therefore, any platform with a reasonably complete HTTP stack is enough to make communicating with a data service simple. That said, a number of client libraries are available which allow for development at a higher level of abstraction.

The requested resource can be any content in the Sense/Net Content Repository. The resource may be addressed with relative or absolute path. Naturally, the requesting user must have permission to the given content. The following requests are equivalent, they both request the content named “Workspaces” located under the site called “ExampleSite”:

http://www.example.com/OData.svc/Root/Sites/ExampleSite/workspaces
http://www.example.com/OData.svc/workspaces

 

Four HTTP methods are used in requests to specify the expected operation:

  • GET: getting one or more entities. The URL contains all request information.
  • PUT: modifying an entity. The URL defines the entity and the request's input stream contains a URL encoded JSON object. This object describes the properties and new values that will be changed on the requested entity.
  • POST: creating an entity. The URL defines the entity and the request's input stream contains a URL encoded JSON object. The URL determines the place and name of the new entity. The JSON object describes the properties and initial values of the new entity.
  • DELETE: deleting an entity. The URL determines the entity that will be deleted. Always only one entity (and its children) will be deleted.

Requests can be sent for individual properties too. A sample property request loads the Display Name of the workspace that has the URL name  “londondocumentworkspace”:

http://www.example.com/OData.svc/workspaces/Document('londondocumentworkspace')/.DisplayName

This returns with the following response:

{
  "d": {
    "DisplayName": "London Document Workspace"
  }
}

 

OData is built on Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years.  OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems, such as Sense/Net.

For more informatuion on OData visit:

http://www.odata.org/introduction

OData client libraries are available for a range of platforms including .NET and Silverlight through WCF Data Services, as well as AJAX, PHP, Java and the IPhone. There are libraries that support the ATOM or JSON format, and thus support OData and Sense/Net, such as Kendo UI.

For a detailed description of the capabilities of the current release, visit:

http://wiki.sensenet.com/index.php?title=OData_REST_API

You can download Sense/Net Community 6.2 with OData support for free:

www.sensenet.com/download

Comments (1) -

samsunny
2/7/2013 3:59:57 PM #

Tamás Bíró i am very pleased to read this post ... it gives me an insight on this topic ....

Pingbacks and trackbacks (1)+

Comments are closed

Welcome to the blog!

Sense/Net ECM is ever evolving. Community means the world to us so we want to keep you apprised on what’s happening on our side of the woods. Want to make us happy? Add a comment and tell us what you think!

Month List