Friday, 7 November 2014

SharePoint 2013 WCF and REST Url


Get Web Details
https://microsoft.sharepoint.com/teams/MySite/Test/_vti_bin/client.svc/web
Get All List information
https://microsoft.sharepoint.com/teams/MySite/Test/_vti_bin/client.svc/web/Lists
Get List Titles using
https://microsoft.sharepoint.com/teams/MySite/Test/_vti_bin/client.svc/web/Lists?$Select=Title
Or
We can use below one.
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists?$Select=Title
Get List
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('Documents')
When you open above link, you can see below tag.
<id>https://microsoft.sharepoint.com/teams/MySite/Test/_api/Web/Lists(guid'103d796b-25cf-4c85-bfbd-ab533b94ee08')</id>
https://microsoft.sharepoint.com/teams/MySite/Test/_api/Web/Lists(guid'103d796b-25cf-4c85-bfbd-ab533b94ee08')
We can open list using Guid. What it will do it internall it will call server side API to get the list using Guid.

_api is alias for _vti_bin/client.svc
We can replace _vti_bin/client.svc with _api

Get list items
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('Documents')/items
Get Only some columns
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('Documents')/items?$select=Title
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('Documents')/items?$select=Title,Modified
For my custom list
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('MyList')/items?$select=Title,Group
Get Specific Item
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('MyList')/items(2)
Filter on title, which starts with T
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('MyList')/items?$filter=startswith(Title,'T')
More than one query string
https://microsoft.sharepoint.com/teams/MySite/Test/_api/web/Lists/GetByTitle('MyList')/items?$select=Title,Group&$filter=startswith(Title,'Test2')
Based on Column: REST API
List item id:
url: http://site url/_api/web/lists/GetByTitle(‘Test')/items(item id)
filter based on column
/_vti_bin/ListData.svc/ListName?$filter=COLUMN1 eq 'VALUE11’


Get all List Columns:
https://SP2010/XXXX/_api/web/Lists/GetByTitle('MyListName')/items