Architecture.

SharePoint's REST Architecture is incredibly robust and easily extensible by design

The SharePoint engineering team did it right when they designed the REST and CSOM object model architecture. This page will describe how that architecture works and how easily it is to be extended (minus the testing of course).

http://blogs.architectingconnectedsystems.com/blogs/cjg/archive/2012/08/13/SharePoint-2013-REST-endpoints-and-more_2E002E002E00_.aspx

How SharePoint REST works:

The REST Architecture is incredibly extensibe. Each development team (BCS, Search, Taxonomoy, Project Server, etc) has the ability to implment there respective REST endpoint in several ways. Depending on how the engineering team wants to expose their APIs, they make different design decisions. This includes:

  • Implement Callable Types with Assembly, Class and Method attributes
  • Implement an IRESTfulRequestHandler
In the case of the core SharePoint team, they chose to implement Callable Types. Callable types allow classes to be exposed to the REST, .NET, and JavaScript APIs. As part of the initialization routine of the REST-ful Services, each of the ServerStubs are loaded into a ProxyMap. When requests are directed to the client.svc the url segments are analyzed to see if the path is supported.

The most important of the assembly attributes are ClientNamespaceMap, UrlSegmentAliasMap, ClientCallableObjectFactoryMap and ClientServiceProcessingHandlerType. ClientNamespaceMap is helpful for the Client API generation (JSOM and CSOM). The UrlSegmentAliasMap allows the development team to map a url endpoint to a class resource. For example:

  • [assembly: UrlSegmentAliasMap("web", "SP.RequestContext.current/web", ResourceType=typeof(SPWeb))]
All the proxy stubs are located in the {SPRoot}\Config\ClientCallable directory.

Proxy stubs define method proxies for the REST and CSOM\JSOM calls.

When determining what API a particular type and method can be executed from, you can look at the ClientLibraryTarget of the ClientCallableAttribute. This can be one of any of the following:

  • All
  • DotNetFramework
  • IntrinsicRESTful
  • JavaScript
  • None
  • NonJavaScript
  • NonRESTful
  • RESTful
  • Silverlight
In the end, REST has much more support than CSOM and JSOM and should be the preferred way of doing your cross platform development.

© 2017 - Architecting Connected Systems

Version 0.8.1