In this blog, I would like to share the code to delete the SharePoint list item using SharePoint Rest API.
Steps to delete the SharePoint list Item
Follow the below steps to delete an item.
Step 1
Create one JS file or you can use the Content Editor Web Part.
Step 2
Below is the API to get the particular list item using Item ID, you can browse this URL in the browser to check whether the API is working or not.
https://sharepoint.com/_api/web/lists/GetByTitle('samplelist')/items/getbyid(1)
Note
Replace your list name with “samplelist”.
Step 3
Refer the jQuery in your HTML file or CEWP.
Use the below code to delete the item from a SharePoint list.
- 'use strict';
- ExecuteOrDelayUntilScriptLoaded(initializePage, "sp.js");
- function initializePage() {
- var siteURL;
- var itemsArray = [];
- // This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
- $(document).ready(function() {
- var scriptbase = _spPageContextInfo.webServerRelativeUrl + "/_layouts/15/";
- DeleteListItem();
- });
- //Retrieve list items from sharepoint using API
- function DeleteListItem() {
- siteURL = _spPageContextInfo.webAbsoluteUrl;
- console.log("from top nav - " + siteURL);
- var apiPath = siteURL + "/_api/lists/getbytitle(''samplelist'')/items/getbyid(1)";
- $.ajax({
- url: apiPath,
- type: "DELETE",
- headers: {
- Accept: "application/json;odata=verbose"
- },
- async: false,
- success: function(data) {
- alert("Item Deleted successfully");
- },
- eror: function(data) {
- console.log("An error occurred. Please try again.");
- }
- });
- }
- }
Summary
In this blog, we have explored how to delete a particular item from SharePoint list using REST API.

Nishikant RathPosted Mar 14, 2018, 5:13 AM
Nice Kaviya but how to delete selected items in a listview webpart in sharepoint 2013 using javascript
Gajendra JangidPosted Mar 10, 2018, 6:23 AM
Great article........................
Naresh SinghalPosted Mar 9, 2018, 3:19 AM
Nice Article...Kaviya Balasubramanian ........