Codes For Getting Items from a SharePoint List using ID

Add some HTML Tags such as TextBox and Table Where the values will be binded after REST call.

Here is the snippet to perform the Above Action.

<input type=”text” id=’txt’ placeholder=”Enter the ID” >

<input type=”button” id=’btn’ value=”Click”>


<table id=”tab” border=1>
<tr id=”tr”>

The jQuery reference File has to be added for reference.


The function which Calls the GET method.

function RESTAPI(){

var x=$(‘#txt’).val();
var url = “/sites/_api/web/lists/GetByTitle(‘LISTNAME’)/items(” + x + “)?$format=JSON”;
url: url1,
method: “GET”,

headers: {
“Accept”: “application/json;odata=verbose”,”Content-Type”: “application/json;odata=verbose”
success: function (data) {

$(‘#val1’).text(data.d.Name + ” ” +data.d.Id)


error: function (error) {
$(document).ready(function () {


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s