SharePoint 2013 REST Services Architecture

Developers can interact remotely with SharePoint 2013 by way of REST services introduced in SharePoint 2013. SharePoint data and objects can be accessed using any technology that supports REST web requests like the ones shown in the picture below. This ability of SharePoint 2013 opens the boundaries of integration and collaboration with other REST based platforms and devices.

REST service architecture

As the REST service architecture in the preceding figure shows, a HTTP request using the OData protocol is sent to SharePoint and your application will receive the response in JSON or ATOM format that your client application needs to parse and utilize. The HTTP request is handled by the "client.svc" web service in SharePoint 2013. The "client.svc" web service internally calls the server object model that retrieves data from the SharePoint content database as shown below. SharePoint Apps are built using these architectural concepts.

server object model call

For example: If you want to retrieve a SharePoint List by its Title then you can create a request as follows:

http://server/site/_api/lists/getbytitle('ListName')

A concrete example:

http://win-4f44sec6iug:34480/sites/ts/_api/lists/getbytitle('ProductList')

In my case the response I receive is as follows:

display feed in IE

Oops!! So IE cannot display the feed;  but I have received the feed from SharePoint. So I right-click and do a view source. I see the entire XML is being sent by SharePoint. To see the XML in IE 10 you need to use the following procedure:

  • "Tools" > "Internet Options"
  • Select the "Content" Tab
  • Under Feeds and Web Slices, select "Settings"

    Feeds and Web Slices

  • Under Advanced section untick "Turn on Feed reading view". Refresh the request; you will see the details in XML format, something as in the following:

    XML format

The following figure (from the MSDN documentation) shows the general syntax structure of SharePoint REST URIs. (Please refer to http://msdn.microsoft.com/en-US/library/office/dn292556.aspx for more details.) The following is the SharePoint REST URI syntax structure.

REST URI syntax structure

The following are some special cases that deviate from this syntax structure:

  • Methods that require complex types as parameters.
  • If the corresponding client object model method requires that complex types be passed as parameters.
  • Static methods and properties.

In the next article we will see how to use these REST APIs from C# programs.