restendpoints

Title: REST service endpoint URIs





End Point
Description
1
http://server/site/_api/web/lists 
 Site
2
http://server/site/_api/web
 Web
3
http://server/site/_api/SP.UserProfiles.PeopleManager
 User Profile
4
http://server/site/_api/search
 Search
5
/_api/web/lists
 List
6
/_api/web/lists/getbytitle('ListName')
 Get by List Name
7
/_api/web/lists('ListGuid')
 Get by List GUID
Note: No issue will come even list name changed after code development.
8
/_api/Web/Lists/getbytitle('ListName')/Fields
Get all fields associated with a list
9
/_api/Web/Lists/getbytitle('ListName')/Fields/getbytitle('FieldName')
Get the Field
10
/_api/Web/Lists/getbytitle('ListName')/Items
Get all items in a list
11
/_api/web/lists/getbytitle('ListName')/GetItemById(itemId)
Get Selected single item
12
/_api/lists/ getbytitle ('ListName')/items?$orderby=Title
Orderby Title
13
/_api/lists/ getbytitle ('ListName')/items?$select=Title,Id
Select Title,ID only if more items in that list
14
/_api/web/lists/getbytitle('ListName')/Items?$select=*
Select All items,Colums
15
16
/_api/web/lists/getbytitle('ListName')/ItemCount
Get Count(How many items)
Ex: 4
17
/_api/web/lists/getbytitle('ListName')/items(16)
Get 16th item
18
/_api/web/lists/getbytitle('ListName')/Items?$select=EmpName&$filter=EmpName eq 'Lakku'

Multibul Filter:
/_api/web/lists/getbytitle('ListName')/Items?$select=EmpName&$filter=((EmpName eq 'Infosys') or (EmpName eq 'wipro'))

/_api/web/lists/getbytitle('ListName')/Items?$select=EmpName&$filter=((EmpName eq 'Infosys') or (EmpName eq 'Wipro')) and (Location eq 'Pune')

Get Empname = Lakku
19
List Name: Employee
Colum name: EmploeeID (type= number)

List name:transport
colums:EID ( type lookup-->from Emplyee list, EmployeeID column)

/_api/web/lists/getbytitle('transport')/Items/?$select=Title,EID/EmployeeID&$expand=EID/EmploeeID

order should be : EID/EmployeeID. should not be EmployeeID/EID

20
1) Get comments for a page:

/_api/web/lists('1aaec881-7f5b-4f82-b1f7-9e02cc116098')/GetItemById(1)/Comments

This will bring back all the top level comments for a page which has the id 1 and lives in a site pages library with guid "1aaec881-7f5b-4f82-b1f7-9e02cc116098".

2) You can also use the list title to get the list and the comments:

/_api/web/lists/GetByTitle('Site Pages')/GetItemById(1)/Comments

3) Get replies for each comment:

/_api/web/lists('1aaec881-7f5b-4f82-b1f7-9e02cc116098')/GetItemById(1)/Comments?$expand=replies

4) Get replies for a specific comment:

/_api/web/lists('1aaec881-7f5b-4f82-b1f7-9e02cc116098')/GetItemById(1)/Comments(2)/replies

Where 2 is the id of the comment.

5) Post a new comment on a page by making a POST request to:

/_api/web/lists('1aaec881-7f5b-4f82-b1f7-9e02cc116098')/GetItemById(1)/Comments

6) To Delete a comment or a reply, Make a DELETE request to:

/_api/web/lists('1aaec881-7f5b-4f82-b1f7-9e02cc116098')/GetItemById(1)/Comments(2)

21
People Picker:
Column Name: RequestedPerson
Column type: People and Group
To get EMail - Case sensitive
/_api/web/lists/getbytitle('employee')/items?$select=RequestedPerson/EMail&$expand=RequestedPerson
/_api/web/lists/getbytitle('employee')/items?$select=RequestedPerson/EMail,EmpID&$expand=RequestedPerson
Note: RequestedPerson is column name. EMail is property for that RequestedPerson  value.

EX:

Title
Name
EMail
MobilePhone
SipAddress
Department
JobTitle
FirstName
LastName
WorkPhone
UserName
Office
ID
Modified
Created
ImnName
NameWithPicture
NameWithPictureAndDetails
ContentTypeDisp


22
User Profile:

1) Get all properties of the current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties



2) Get a single property of current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties/PictureUrl
OR
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl


3) Get Multiple Properties for the current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName


4) Get all properties of Specific User:

For Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'

For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username'



5) Get Specific UserProfile Property of Specific User:

For Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'


For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'

6) Get Multiple UserProfile Properties for Specific User:


http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor


23
Search:
/site/search/_api/search/query
/site/search/_api/search/postquery
/site/search/_api/search/suggest

Filter:
/_api/search/query?querytext='Susila'&rowlimit=50
Note: 10 is default row limit
/_api/search/query?querytext='Susila'&startrow=11
/_api/search/query?querytext='Susila'&startrow=11&rowlimit=50
/_api/search/query?querytext='Susila'&sortlist='EName:ascending'
/_api/search/query?querytext='Susila'&selectproperties='Author,Title,Path'



24
 App-Web-URL/_api/SP.AppContextSite(@target)/web/lists/getbytitle(List-Name‘)/items?@target=’Host-Web-URL

25


26

/Lists/Lakkulist/AllItems.aspx

/_api/web/lists
/_api/web/lists/getbytitle('Lakkulist')
/_api/web/lists/getbytitle('Lakkulist')/Fields
/_api/web/lists/getbytitle('Lakkulist')/Fields/getbytitle('EMPLocation')
Note: getbytitle for fields as well

/_api/web/lists/getbytitle('Lakkulist')/Items
/_api/web/lists/getbytitle('Lakkulist')/items?$select=Title,Location
/_api/web/lists/getbytitle('Lakkulist')/items?$select=*
/_api/web/lists/getbytitle('Lakkulist')/Items?$select=Location,Title&$filter=Location eq 'Bangalore'
/_api/web/lists/getbytitle('Lakkulist')/items?$orderby=Location
/_api/web/lists/getbytitle('Lakkulist')/Items?$filter=Location eq 'Lakku'
/_api/web/lists/getbytitle('Lakkulist')/Items?$select=Location,Title&$orderby=Location&$filter=Location eq 'Bangalore'

Note: ? should need

/_api/web/lists/getbytitle('Lakkulist')/GetItemById(1)

Note: GetItemById(1): should be number without single or double quota.


/_api/web/lists/getbytitle('Lakkulist')/items(1)

1st item will display: start from 1 (not 0)