Compartilhar via


SharePoint Foundation REST Interface

Applies to: SharePoint Foundation 2010

Available in SharePoint Online

The new REST (Representational State Transfer) interface in Microsoft SharePoint Foundation 2010 provides access to lists and libraries as a relational data service. A core concept of any RESTful interface is the resource, and in SharePoint Foundation, lists and items are represented as HTTP resources that can be addressed by remote URLs.

Operations in the SharePoint Foundation REST interface constitute a standard set of operations for RESTful web services. Read, create, update, and delete operations are mapped directly to GET, POST, PUT, and DELETE HTTP verbs. This eliminates the need for intermediate layers between client and server, and it is useful for interoperability because it allows applications from other platforms to easily connect to SharePoint Foundation. Interoperability is one of the advantages of new SharePoint Foundation REST interface, but the REST interface also provides a great development experience through integration with ADO.NET Data Services, on which it is based.

The REST interface uses flexible URL conventions for querying data, which enable you to filter, sort and select information from SharePoint Foundation lists directly from the browser. You can also retrieve information from SharePoint Foundation lists through multiple representations, including support for JavaScript Object Notation (JSON), Atom, and AtomPub standards. Standard representations for SharePoint Foundation lists makes list data available to standards-compliant clients, starting from simple Atom feed-readers, to more advanced clients that enable end users to analyze large quantities of data in Microsoft Excel. Advanced features of ADO.NET Data Services are also supported by the SharePoint Foundation REST interface, such as batching multiple operations into a single request, concurrency control through HTTP ETags, paging of large data sets, and access to document streams in SharePoint document libraries.

The following table shows example URLs that implement the REST interface.

URL

Description

http://myserver/_vti_bin/ListData.svc

Typing the URL of the REST service returns a standard Atom service document that describes collections of information that are available in the SharePoint Foundation site.

http://myserver/_vti_bin/ListData.svc/Projects

Typing a name after the URL of the service returns SharePoint Foundation list data in XML format as a standard Atom feed that contains entries for every list item and the properties of each item, in addition to navigation properties that are represented as Atom links. Navigation properties represent relationships to other SharePoint Foundation lists that are formed through lookup columns.

http://myserver/_vti_bin/ListData.svc/$metadata

The SharePoint Foundation interface returns entity data model XML that describes the entity types for every list in the website.

http://lsspf4719/sites/TestWebs/_vti_bin/listdata.svc/Employees(2)

Returns the specified list item by ID (2) as an Atom feed with one entry that corresponds to the requested item.

http://lsspf4719/sites/TestWebs/_vti_bin/listdata.svc/Employees?$orderby=Name

Sorts the Atom feed by name.

http://lsspf4719/sites/TestWebs/_vti_bin/listdata.svc/Employees?$filter=Project/Title eq 'My Project Title'

Uses a navigation property to filter the list by title of a related project.

By taking advantage of new capabilities of the SharePoint Foundation data store, REST queries provide a flexible mechanism for working with SharePoint Foundation list data in XML format, and any application that can send REST URLs to SharePoint Foundation can retrieve its list data. As an example, the REST interface uses the new joins feature of lists, so that when SharePoint Foundation receives an ADO.NET Data Services query that implements the joins feature, the query is translated into a native Collaborative Application Markup Language (CAML) query.

See Also

Concepts

Query SharePoint Foundation with ADO.NET Data Services

List Joins and Projections

Other Resources

WCF REST Programming Model