Understanding REST APIs in Office 365, SharePoint 2013 & Custom Development

By Errin O'Connor posted 10-18-2014 16:35


Understanding REST APIs in Office 365, SharePoint 2013 & Custom Development


The REST APIs are very straightforward and easy to use and allow for a platform-agnostic development approach. Each query that is submitted is done via a unique URL, and the returned results can be cached by proxy servers. The REST APIs are easier to utilize than a SOAP-based web service and provide for higher productivity when JavaScript and jQuery are used.

You can access resources utilizing REST capabilities in SharePoint 2013 by constructing a RESTful HTTP request, using OData, which corresponds to the desired client object model API.

The client.svc service handles the HTTP request and serves the appropriate response in either Atom or JSON (JavaScript Object Notation) format, and the client application must then parse that response.

EPC Group Tip “From the Trenches”

The endpoints in the SharePoint 2013 REST service correspond to the types and members in the SharePoint client object models. The utilization of these HTTP requests allows for the use of these REST endpoints to perform typical CRUD (create, read, update, and delete) operations against SharePoint entities like SharePoint sites or lists.

The URI (uniform resource identifier) for these REST endpoints closely mimics the API signature of the resource in the SharePoint client object model, as the main entry points for the REST service represent the site collection and site of the specified context that is submitted. To provide an overview of this, a specific site collection can be accessed by using the following:

http:// server site /_ api site

If you are wanting to access a specific site, you would do so by using the following:

http:// server site /_ api web

The server always represents the name of the server and the site represents the name of the site or the path to the specific site. By using this as a baseline, you can then construct more specific REST URIs by utilizing the object model names of the APIs from the client object model separated by a forward slash (/).

EPC Group Tip “From the Trenches”

The differences between a URI, a URN, and a URL can be confusing due to the similarities

of the concepts of all three of these terms.

  • A URI is a uniform resource identifier, which is a string of characters used to identify a name or a resource on the Internet. A URI identifies a resource by location, by name, or both. A URI has two specializations known as URL and URN.
  • A URL is a uniform resource locator, which is a subset of the URI. The URL specifies where an identified resource is available, as well as the mechanism for retrieving it, and defines how the resource can be obtained.
  • A URN is a uniform resource name is actually a URI that uses the URN scheme but does not imply availability of the identified resource.

This means that both URNs (names) and URLs (locators) are URIs, and a specific URI may be both a name and a locator at the same time.

To clarify this in an example, EPC Group is the consulting firm that I work for and the name “EPC Group” can be used as an “identification.”

There are also a few firms overseas named EPC Group but they are in manufacturing and in other business verticals; so just telling you the company name “EPC Group” does not provide you any specifics on just the face value of the “identification” provided.

Think of the differences, in terms of performing a Bing or Google search, between the terms “EPC Group” and “EPC Group SharePoint 2013 Office 365 Houston.”

The second search term provides additional metadata, which then will provide more specifics to identify the correct company and its location.

A URN is very similar to a name and a URL is similar to a street address; the URN defines the actual identity whereas the URL provides a location. So in summary, a URL is a URI that identifies a specific resource and also provides the means by which you can locate the resource by describing the way to access it.

Note: Some new browser updates, such as in Google Chrome, are now dropping the protocol from the display within the browser, which visually turns URLs into URIs.

Calendar REST API in Office 365 APIs Preview

The Calendar API provides full access to calendar groups, calendars, and events in Exchange Online as part of  Office 365. From checking for upcoming events to sending meeting invitations, the Calendar API has it covered.

Mail REST API in Office 365 APIs Preview

The Mail API provides full access to email messages and mail folders in a user's mailbox in Exchange Online as part of Office 365. From reading to sending email, the Mail API has it covered.

Files REST API in Office 365 APIs Preview

The Files REST API in Office 365 APIs Preview represents a redesign of the file storage and management API for SharePoint. The Files API allows you to access and manipulate the contents of Office documents (files, presentations, spreadsheets, for example), as well as mail, calendar, contacts, and SharePoint data.

The REST APIs and OData in SharePoint 2013


REST APIs in SharePoint 2013 are now compatible with OData, the industry standard for creating and consuming data APIs. The official reference for OData, as well as to track updates regarding this industry standard, can be found at the following link:

OData’s official description, in essence, states that OData builds on core protocols like HTTP and commonly accepted methodologies like REST, resulting in a uniform way to expose full-featured data APIs.

In terms of SharePoint 2013, OData is a protocol for interacting with RESTful web services. It was released under Microsoft’s open specification promise; it works on top of standard HTTP using HTTP GET, POST, PUT, and DELETE verbs and returns standard ATOM or JSON formatted results.

For more information regarding Microsoft’s open specifications promise, refer to the following link:

RESTful web services are basically those services or applications that conform to REST constraints, and any service that does not conform to the required constraints should not be considered RESTful.

There is a very strong focus on resources within RESTful web services and they should be simple for a developer to utilize. These services should follow these four principles:

  • Utilize HTTP methods appropriately
  • Expose data in a directory structure
  • Be stateless
  • Transfer either XML or JSON formatted results, as shown in the images below

Microsoft has also recently released a 300-plus page OData/open specifications whitepaper for protocols, file formats, languages, and standards, as well as overviews of the interaction among each of these technologies, which can be accessed at the following link:

REST and Search in SharePoint 2013

The new Search capabilities in SharePoint 2013 include a Search REST service that you can utilize to add search features and functionality to your organization’s client applications as well as your mobile applications that support REST web requests.

This capability enables you to use the Search REST service to submit Keyword Query Language (KQL) or FAST Query Language (FQL) queries in apps for SharePoint, mobile apps, and remote client apps. In addition, the new Search REST service also supports both HTTP POST and HTTP GET requests.

For GET requests, you would construct the URI for query GET requests to utilize the

Search REST service by using the following:


The GET request specifies the query parameters in the URL and can utilize two options for constructing GET requests as detailed here:




For POST requests, you would construct the URI for query POST requests to utilize the

Search REST service by using the following:


The POST requests are passed via the query parameters in the request in JSON format, and the HTTP POST version of the Search REST service supports all the parameters supported by the HTTP GET version.

You should utilize POST requests whenever the following is true:

  • You have concerns about the length of your URL due to URL length restrictions that may be experienced with a GET request.
  • You cannot specify the query parameters via a simple URL such as those in pass parameter values that contain a complex type array because there is added flexibility around the construction of POST requests.

You must ensure that whenever a call is made to the Search REST service, the specific query parameters are included with the request because these query parameters are used to construct the underlying SharePoint search query.

These query parameters are specified in different manners between GET and POST requests:

  • GET requests specify the query parameters in the URL.
  • POST requests pass the query parameters in the body in JavaScript JSON format.

EPC Group’s Nationally Recognized Practice Areas

EPC Group leading Custom Application DevelopmentSharePoint, Office 365, Infrastructure Design and Business Intelligence Practice areas continue to lead the way in providing our clients with the most up-to-date and relevant information that is tailored to their individual business and functional needs.

Additional "From the Consulting Trenches" strategies and methodologies are covered in EPC Group's new book, "SharePoint 2013 Field Guide: Advice from the Consulting Trenches" covering not only SharePoint 2013, Office 365 and SharePoint Online but Information Management, ECM\RM and overall compliance strategies in this ever changing world of "Hybrid IT."

#SharePoint #BusinessProcessManagement #Office365CustomDevelopment #SharePoint2013CustomDevelopment #HybridCustomDevelopment