Deleting Data Items

Deleting Data Items

The Backend Services RESTful API allows you to delete a single item based on its ID or batch delete multiple items based on a filter.

This article is organized as follows:

Single Item

The following code snippet shows how to delete a single content type item by ID.

Request:
    DELETE https://api.everlive.com/v1/your-app-id/type-name/item-id
Headers:
    Authorization Bearer your-access-token

Response:
    Status: 200 OK
Content-Type:
    application/json
Body:
    {
        "Result": 1
    }
$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/type-name/item-id',
    headers: { "Authorization" : "Bearer your-access-token" },
    contentType: "application/json",
    success: function(){
        alert("Item successfully deleted.");
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})

All Items

The following code snippet shows how to delete all items in a content type.

    DELETE https://api.everlive.com/v1/your-app-id/type-name
Header:
    Authorization Bearer your-access-token
Response:
    Status: 200 OK
Content-Type:
    application/json
Body:
    {
        "Result": 44
    }
$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/type-name',
    headers: {
        "Authorization" : "Bearer your-access-token"
    },
    contentType: "application/json",
    success: function (data) {
        alert("Items successfully deleted.");
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }
})

Multiple Items by Filter

The following code snippet shows how to delete multiple content type items selected using a filter expression.

Always double-check your filter expression and test it on a dummy copy of your data. This will help you avoid destroying the wrong items.

Request:
    DELETE https://api.everlive.com/v1/your-app-id/type-name
Header:
    Authorization  Bearer your-access-token
    X-Everlive-Filter {"Author" : "Sample Text"}

Response:
    Status: 200 OK
Content-Type:
    application/json
Body:
    {
        "Result": 5
    }
var filter={"Author" : "Sample Text"};
$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/type-name',
    headers: {
        "Authorization" : "Bearer your-access-token",
        "X-Everlive-Filter": JSON.stringify(filter)
    },
    contentType: "application/json",
    success: function (data) {
        alert("Items successfully deleted.");
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }
})

Multiple Items by Paging

The following code snippet shows how to delete multiple content type items selected using paging of filtered data. It deletes items 31 to 40, a total of 10 items.

Request:
    DELETE https://api.everlive.com/v1/your-app-id/type-name
Header:
    Authorization  Bearer your-access-token
    X-Everlive-Filter {"Author" : "Sample Text"}
    X-Everlive-Skip : 30,
    X-Everlive-Take : 10
Response:
    Status: 200 OK
Content-Type:
    application/json
    {
        "Result": 10
    }
$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/type-name',
    headers: {
        "Authorization" : "Bearer your-access-token",
        "X-Everlive-Skip" : 30,
        "X-Everlive-Take" : 10
    },
    contentType: "application/json",
    success: function (data) {
        alert("Items successfully deleted.");
    },
    error: function (error) {
        alert(JSON.stringify(error));
    }
})

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.