Muokkaa

Jaa


BCS REST API reference for SharePoint

Class libraries and references

Contains reference information for constructing Representational State Transfer (REST) URLs to access and manipulate external data sources using Business Connectivity Services (BCS) in SharePoint.

Using RESTful APIs to access external data in SharePoint

The REST interface provided by SharePoint enables you to access most SharePoint resources through specially constructed URLs. Business Connectivity Services (BCS) uses this architecture to provide access to external data.

You can access external data by constructing URLs just as you would to access standard list items.

Note

Access to entities through the BDC directly is not provided. To work with external data, you must create an external list and use the REST URLs to access the list items contained in the external list.

The supported HTTP verbs for working with external lists are GET, PUT, POST, and DELETE.

Unlike with normal lists, you can't create an external list using REST. You must do that by creating a BDC model and an external list using Visual Studio 2012.

The information in Table 1 shows how to construct RESTful URLs and the corresponding client object model calls to access and manipulate data from external data sources.

Table 1. RESTful URL formats for accessing external data

URL Description HTTP method
http://[sharepointsite]/_api
The base of any REST request. The _api virtual directory is mapped to call into client.svc, where the client object model can be used.
GET
http://[sharepointsite]/_api/web/title
Retrieves the title of the current web.
GET
http://[sharepointsite]/_api/lists
Retrieves all lists on a site.
GET
http://[sharepointsite]/_api/lists/getbytitle('listname')
Retrieves the metadata for a specified list.
GET
http://[sharepointsite]/_api/lists/getbytitle('listname')/items
Retrieves the list items in a specified list.
GET
http://[sharepointsite]/_api/lists/getbytitle('listname')?select=Title
Retrieves the title of a specific list.
GET

Constructing query strings for filtering data

In order to limit the amount of data returned, or make it more relevant to the user, you can use the filter operations found in Table 2.

Table 2. Operators for filtering data

Operator Description
EQ
Equals
Note: When you use EQ to filter, the filter criteria are passed to the external system where the filtering happens on the server.
GT
Greater Than
Note: When you use the GT operator, only client-side filtering is executed.> For example: web/lists/getByTitle('ListName')/Items?$select=Title&$filter=AverageRating gt 3 returns all titles with an average rating over 3.

Note

To retrieve columns that are part of an association, you must explicitly include the column in the URL using $select in the query string.

See also