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

Updating Files

Updating Files

The Backend Services RESTful API allows you to update a file stored by Telerik Platform. This includes two operations: updating the file's metadata and updating the file's content.

Update Metadata

File metadata includes the file name and any custom fields that you may add. The following code snippet shows how to change the name of an uploaded file and add a custom field called Description.

Request:
    PUT https://api.everlive.com/v1/your-app-id/Files/item-id
Headers:
    Authorization Bearer your-access-token
    Content-Type application/json
Body:
  {
    "Filename": "newFileName.png",
    "Description": "Arbitrary description."
  }  

Response:
    Status: 200 OK
Content-Type:
    application/json
Body:
    {
      "ModifiedAt": "2016-07-04T15:37:54.485Z",
      "Result": 1
    }
var file = {
    "Filename": "newFileName.png",
    "Description": "Arbitrary description."
};

$.ajax({
    type: "PUT",
    url: 'https://api.everlive.com/v1/your-app-id/Files/item-id',
    headers: { "Authorization" : "Bearer your-access-token" },
    contentType: "application/json",
    data: JSON.stringify(file),
    success: function(data){
        alert(JSON.stringify(data));
    },
    error: function(error){
        alert(JSON.stringify(error));
    }
})

Update Content

The file content is the binary data of the actual file. To update it, pass a base64-encoded string together with the file metadata.

Request:
    PUT https://api.everlive.com/v1/your-app-id/Files/item-id/Content  
Headers:
    Authorization Bearer your-access-token
    Content-Type application/json
Body:
    {
        "Filename": "newFileName.png",
        "ContentType": /* MIME type of the file content ("image/jpeg" for example) */,
        "base64": /* the new file content in base64 format */
    }  

Response:
    Status: 200 OK
    Content-Type: application/json
var file = {
    "Filename": "newFileName.png",
    "ContentType": /* MIME type of the file content ("image/jpeg" for example) */,
    "base64": /* the new file content in base64 format */
};

$.ajax({
    type: "PUT",
    url: 'https://api.everlive.com/v1/your-app-id/Files/item-id/Content',
    headers: { "Authorization" : "Bearer your-access-token" },
    contentType: "application/json",
    data: JSON.stringify(file),
    success: function(data){
        alert(JSON.stringify(data));
    },
    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.