Posts

Showing posts with the label REST Services

SharePoint 2013 - Get list items using REST

Here I demonstrated how to fetch items of a SharePoint list using Rest. Example code for REST: //get the title of the site var siteUrl = _spPageContextInfo.webAbsoluteUrl; //Ajax call to get data $.ajax({ url: siteUrl + "/_api/web/lists/getbytitle('Give Title of List Name')/items" , method: "GET" , headers: { "Accept" : "application/json; odata=verbose" }, success: function (data) { var listitems = data.d.results; // listitems.forEach(function (entry) { // $('#message').text(listitems["FirstName"]); // }); }, error: function (data) { alert( "Error" ) } });

SharePoint 2013 - Get list items using REST

Here I demonstrated how to fetch items of a SharePoint list using Rest. Example code for REST: //get the title of the site var siteUrl = _spPageContextInfo.webAbsoluteUrl; //Ajax call to get data $.ajax({ url: siteUrl + "/_api/web/lists/getbytitle('Give Title of List Name')/items" , method: "GET" , headers: { "Accept" : "application/json; odata=verbose" }, success: function (data) { var listitems = data.d.results; // listitems.forEach(function (entry) { // $('#message').text(listitems["FirstName"]); // }); }, error: function (data) { alert( "Error" ) } });