Reading File Metadata

Reading File Metadata

The Backend Services RESTful API provides an HTTP endpoint for retrieving metadata about single and multiple files based on an ID or a filter expression. The metadata contains the file's download URI.

In this article:

Single File

To get the metadata of a single file, specify the file ID after the Files endpoint in a GET request.

Request:
    GET https://api.everlive.com/v1/your-app-id/Files/item-id
Headers:
    Authorization  Bearer your-access-token
    Content-Type: application/json

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

All Files

To get all the metadata of all files stored in Files, make a GET request to the Files endpoint.

Request:
    GET https://api.everlive.com/v1/your-app-id/Files
Headers:
    Authorization  Bearer your-access-token
    Content-Type: application/json

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

Multiple Files' Metadata by Filter

To get the metadata of multiple files by filter, include your filter criteria using the X-Everlive-Filter header.

Request:
    GET https://api.everlive.com/v1/your-app-id/Files
Headers:
    Authorization  Bearer your-access-token
    X-Everlive-Filter : { "$and": [{ "Length": { "$gte":50000} }, {"Filename":"avatar.jpg"}]}
    Content-Type: application/json

Response:
    Status: 200 OK
    Content-Type: application/json
var filter = {
    "$and": [{ "Length": { "$gte":50000} }, {"Filename":"avatar.jpg"}]
};

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

Multiple Files' Metadata with Paging

To page the results, include the X-Everlive-Skip header.

Request:
    GET https://api.everlive.com/v1/your-app-id/Files
Headers:
    Authorization  Bearer your-access-token
    X-Everlive-Skip : 1
    X-Everlive-Take : 1
    Content-Type: application/json

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

Multiple Files' Metadata with Sorting

To sort the result use "X-Everlive-Sort" header. The value must be object. Each property corresponds to item's property and the value must be 1 or -1 (1 for ascending and -1 for descending).

Request:
    GET https://api.everlive.com/v1/your-app-id/Files  
Headers:
    Authorization  Bearer your-access-token
    X-Everlive-Sort  { "Length": 1 }
    Content-Type  application/json  

Response:
    Status: 200 OK
    Content-Type: application/json
var sortExp = { "Length": 1 };

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

Relation Expansion

When reading file metadata as a result of relation expansion, remember to refer to the Files content type as System.Files. See Expand Expression Examples for example code.

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.