Presented by Paolo Pialorsi at SharePoint Saturday Stockholm 2014
See also http://www.spsstockholm.com/2014/session/understanding-the-rest-api-of-sharepoint-2013/
From a developer perspective, one of the most important new features introduced in Microsoft SharePoint 2013 is the REST API. In this session, you learn about the architecture of the REST API, the main and most useful endpoints, and you see a bunch of real-life usage samples to leverage the API in your SharePoint Apps. To attend this session you should have a good understanding of developing SharePoint Apps.
6. _api is new alias for _vti_bin/client.svc
Server
Client
REST
OData
JSON
CSOM
JavaScript
Library
Silverlight
Library
Custom Client Code
.Net CLR
Library
7.
8.
9.
10.
11.
12.
13. Web Application Hostname
API Namespace
http(s)://{Host Name}/{site}/_api/{namespace}/
{object}
{property}
{indexer(index)}
{method({parameter},{parameter},…)}
Site Collection (Optional)
Operation
14.
15.
16.
17. Operator
Description
Example
eq
Equal
/Suppliers?$filter=Address/City eq 'Redmond'
ne
Not equal
/Suppliers?$filter=Address/City ne 'London'
gt
Greater than
/Products?$filter=Price gt 20
ge
Greater than or equal
/Products?$filter=Price ge 10
lt
Less than
/Products?$filter=Price lt 20
le
Less than or equal
/Products?$filter=Price le 100
and
Logical and
/Products?$filter=Price le 200 and Price gt 3.5
or
Logical or
/Products?$filter=Price le 3.5 or Price gt 200
not
Logical negation
/Products?$filter=not endswith(Description,'milk')
19. Function
Description
bool substringof(string searchString, string searchInString)
Returns a boolean value stating if the value
provided in the first argument is a substring of substringof('Alfreds',CompanyName)
the second argument. Can be used as a
replacement for the contains method.
bool endswith(string string, string suffixString)
Returns a boolean value declaring if the string
endswith(CompanyName,'Futterkiste')
provided in the first argument ends with the
string provided in the second argument.
bool startswith(string string, string prefixString)
Returns a boolean value declaring if the string
provided in the first argument starts with the startswith(CompanyName,'Alfr')
string provided in the second argument.
int length(string string)
Returns an integer value representing the
length of the string provided as argument.
int indexof(string searchInString, string searchString)
string replace(string searchInString, string searchString, string
replaceString)
string substring(string string, int pos)
Example
length(CompanyName) eq 19
Returns an integer value representing the
index of the string provided in the second
indexof(CompanyName,'lfreds') eq 1
argument, which is searched within the string
provided in the first argument.
Replaces the string provided in the second
argument with the string provided in the third replace(CompanyName,' ', '') eq
'AlfredsFutterkiste'
argument, searching within the first string
argument.
Returns a substring of the string provided in
the first argument, starting from the integer
position provided in the second argument.
substring(CompanyName,1) eq 'lfreds
Futterkiste'
20. Function
Description
string substring(string string, int pos, int length)
Returns a substring of the string provided in
the first argument, starting from the integer
position provided in the second argument and substring(CompanyName,1, 2) eq 'lf'
stopping after a number of characters
provided in the third integer argument.
string tolower(string string)
string toupper(string string)
Returns a string that is the lowercase
conversion of the string provided as the string
argument
Returns a string that is the uppercase
conversion of the string provided as the string
argument
Example
tolower(CompanyName) eq 'alfreds
futterkiste'
tolower(CompanyName) eq 'alfreds
futterkiste'
string trim(string string)
Returns a string trimmed from spaces, based
on the string provided as argument.
trim(CompanyName) eq 'Alfreds Futterkiste'
string concat(string string1, string string2)
Returns a string that is the concatenation of
the two string arguments provided.
concat(concat(City,', '), Country) eq 'Berlin,
Germany'
int day(DateTime datetimeValue)
int hour(DateTime datetimeValue)
int minute(DateTime datetimeValue)
int month(DateTime datetimeValue)
Returns an integer that corresponds to the
day of the datetime value provided as
argument.
Returns an integer that corresponds to the
hours of the datetime value provided as
argument.
Returns an integer that corresponds to the
minutes of the datetime value provided as
argument.
Returns an integer that corresponds to the
month of the datetime value provided as
argument.
day(BirthDate) eq 8
hour(BirthDate) eq 1
minute(BirthDate) eq 0
month(BirthDate) eq 12
21. Function
int second(DateTime datetimeValue)
int year(DateTime datetimeValue)
double round(double doubleValue)
decimal round(decimal decimalValue)
double floor(double doubleValue)
decimal floor(decimal datetimeValue)
double ceiling(double doubleValue)
decimal ceiling(decimal datetimeValue)
Description
Returns an integer that corresponds to the
seconds of the datetime value provided as
argument.
Returns an integer that corresponds to the
year of the datetime value provided as
argument.
Returns a double number that is the rounded
value of the double value provided as
argument.
Returns a decimal number that is the rounded
value of the decimal value provided as
argument.
Returns a double number that is the floor
value of the double value provided as
argument.
Returns a decimal number that is the floor
value of the decimal value provided as
argument.
Returns a double number that is the ceiling
value of the double value provided as
argument.
Returns a decimal number that is the ceiling
value of the decimal value provided as
argument.
Example
second(BirthDate) eq 0
year(BirthDate) eq 1948
round(Freight) eq 32
round(Freight) eq 32
floor(Freight) eq 32
floor(Freight) eq 32
ceiling(Freight) eq 33
ceiling(Freight) eq 33
bool IsOf(type value)
Returns a boolean value stating if the target
entity is of the type provided as argument.
bool IsOf(expression value, type targetType)
Returns a boolean value stating if the
isof(ShipCountry,'Edm.String')
expression provided as the first argument, is
of the type provided as the second argument.
isof('NorthwindModel.Order')
32. SP.RequestExecutor.j
s
2) Emit IFrame
App Web
3) Download proxy page
IFrame
(AppWebProxy.ASPX)
6) Get data back to app
4) Make REST/CSOM call
5) Get response data
Host Web