sharepointREST Services


Remarks

REST Service Endpoint URLs

The REST client access API was first introduced in SharePoint 2010, but was greatly expanded in SharePoint 2013. The REST API in SharePoint 2010 is accessed through the ListData web service at the /_vti_bin/ListData.svc url. SharePoint 2013 introduced the /_api/lists/ and /_api/web endpoint URLs, which behave slightly differently.

The above endpoint URLs should be preceded by http://server/site where server represents the name of the server, and site represents the name of, or path to, the specific site.

Example URL for...SharePoint 2010SharePoint 2013
Fetching a List:/_vti_bin/ListData.svc/ListName/_api/lists('ListGuid')
Fetching an Item:/_vti_bin/ListData.svc/ListName(1)/_api/lists('ListGuid')/items(1)
Fetching a Web:(no equivalent)/_api/web

Despite the differences in accessing lists and list items, working with those results is very similar in both versions.

Note that the ListData.svc service is still available in SharePoint 2013 for backwards compatibility.

Sending REST Requests

A REST request can be submitted via a native JavaScript XMLHttpRequest or via the jQuery AJAX wrapper construct.

XMLHttpRequest Syntax

var xhr = new XMLHttpRequest();
xhr.open(verb, url, true);
xhr.setRequestHeader("Content-Type","application/json");
xhr.send(data);

jQuery AJAX Syntax

$.ajax({
    method: verb,
    url: url,
    headers: { "Content-Type":"application/json" },
    data: data
});

For more details on sending requests via AJAX, see the JavaScript AJAX documentation.