Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Deleting Files

Deleting Files

The Backend Services RESTful API supports deleting single and multiple files. Single deletion is based on ID and multiple deletion is done using a filter expression.

Single file

To delete a file by Id, you have to execute the following code snippet:

$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/Files/item-id-here',
    headers: { "Authorization" : "Bearer your-access-token-here" },
    contentType: "application/json",
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})
Request:
    DELETE https://api.everlive.com/v1/your-app-id/Files/item-id-here  
Headers:
    Authorization  Bearer your-access-token-here
    Content-Type application/json  
Response:
    Status: 200 OK
    Content-Type: application/json

Multiple files

Multiples files can be delete in one request as well. It is very similar to deleting multiple items from custom content type - by filter or all items.

The example below demonstrates how to delete files with filter. If you want to delete all files, you just do not specify filter

var filter = { "ContentType" : "image/jpg" }; 

$.ajax({
    type: "DELETE",
    url: 'https://api.everlive.com/v1/your-app-id/Files',
    headers: {
        "Authorization" : "Bearer your-access-token-here",
        "X-Everlive-Filter" : JSON.stringify(filter)
    },
    contentType: "application/json",
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})
Request:
    DELETE https://api.everlive.com/v1/your-app-id/Files  
Headers:
    Authorization  Bearer your-access-token-here
    X-Everlive-Filter { "ContentType" : "image/jpg" }
    Content-Type application/json  
Response:
    Status: 200 OK
    Content-Type: application/json

Note: The server does not return the number of deleted files. The response contains empty java script object. You have to use the Http status to tell if the request is successful.

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.