Thursday, December 18, 2014

Quick Rest Interface samples to reuse

SP2013
http:///site/_api/lists
http:///site/_api/web/title
http:///site/_api/lists/getbytitle('listname')
http:///site/_api/lists/getbytitle('listname')/items
http:///site/_api/lists/getbytitle('listname')?select=Title
http:///site/_api/lists/getbytitle('listname')/Lists (POST)
Body
{
'_metadata':{'type':SP.List},
'AllowContentTypes': true,
'BaseTemplate': 104,
'ContentTypesEnabled': true,
'Description': 'My list description',
'Title': 'RestTest'
}

http:///site/_api/lists/getbytitle('listname')/lists/getbytitle('listname')/items (POST)
Body
{
'_metadata':{'type':SP. listnameListItem},
'Title': 'MyItem'
}

SP2010
http:///_vti_bin/ListData.svc
http:///_vti_bin/ListData.svc/ListName
http:///_vti_bin/ListData.svc/$metadata
http:///sites//_vti_bin/listdata.svc/TestData(2)
http:///sites//_vti_bin/listdata.svc/TestData?$orderby=FieldName
http:///sites//_vti_bin/listdata.svc/TestData?$filter=FieldName eq 'testval'

References :
http://msdn.microsoft.com/en-us/library/office/jj164022(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/office/ff521587(v=office.14).aspx

No comments: