Reputation: 101
I am trying to delete Office 365 SharePoint site using rest API but i don't know how to do it. Is there any way to delete office 365 SharePoint site using rest APi.
Note: I am using Graph Explorer to create site on SharePoint and now i want to completely delete it.
Upvotes: 0
Views: 1599
Reputation: 3655
Try this:
var restAPIURL = "siteurl/_api/web"
$.ajax
({
url: restAPIURL,
type: "POST",
async: false,
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $('#__REQUESTDIGEST').val(),
"X-HTTP-Method": "DELETE"
},
success: function(data){
console.log('site deleted');
},
error: function(data){
console.log('Error deleting site');
}
});
Reference:
Upvotes: 0