How to show List items in SharePoint 2013 Using REST API and Content Editor Web Part

Hi Fellow Share Pointers,

SharePoint 2013 introduces a new set of API’s – REST APIs to access SharePoint data in a faster and cleaner way. SharePoint REST API’s provide you the client side compatibility to work with SharePoint List and Library objects. With the help of SharePoint REST APIs we can work with the following SharePoint Objects.

The below are list of SharePoint REST API Access Points

1.Site
http://server/site/_api/site

2.Web
http://server/site/_api/web

3.User Profile
http:// server/site/_api/SP.UserProfiles.PeopleManager

4.Search
http:// server/site/_api/search

5.Publishing
http:// server/site/_api/publishing

In this article, I will provide you with a piece of code which displays SharePoint Custom List using REST API’s and Jquery. The entire code is placed in the Content Editor Web Part. Content Editor Web Part is used to add client side scripting.

$(document).ready(function(){

/
$.ajax({

url: _spPageContextInfo.webAbsoluteUrl + “/_api/web/lists/getbytitle(‘MyEmployeeList‘)/items”,

type: “GET”,

headers: {“accept”: “application/json;odata=verbose”},

success: function (data) {

if (data.d.results) {

var object = data.d.results;

for(var i = 0; i < object.length; i++)

{

$(“#showlistitems”).append(“

Name “+object[i].EmpName+”

“);

}

}

},

error: function (xhr,text_status) {

alert(xhr.status + ‘: ‘ + xhr.statusText);

}

});

Please read other useful and interesting articles on 

Retrieving Query Results by Date Range in SharePoint Site 2013 Using REST SEARCH API

Share you SharePoint Site to External User in SharePoint Online /Office 365

Delete List in Sharepoint 2013/Office 365 using CSOM

Delete ContentTypes in Sharepoint 2013/Office 365 using CSOM

Apply-site-logo-in-office-365-using-csom-code

Happy Share Pointing  Folks 🙂

One thought on “How to show List items in SharePoint 2013 Using REST API and Content Editor Web Part

  1. pradeep says:

    How can i get list item display form uri and itrate the every list item and add that uri to list item.

Leave a Reply

Your email address will not be published. Required fields are marked *