Retrieving File List

Retrieving files list

By using the X-Appery-Master-Key, all the files from the Files collection will be included into the file list, despite specified ACL.

To retrieve a files list based on the files in the Files collection, send GET request and specify database id:

https://api.appery.io/rest/1/db/files

It’s necessary to provide an X-Appery-Session-Token or X-Appery-Master-Key to get the file list. In the case of using the X-Appery-Session-Token file, the list will contain only those files that where uploaded by the current user, or files that were uploaded via the Media Manager, and doesn’t contain default ACL:

Example

curl -X GET 
 -H "X-Appery-Database-Id: 544a5cdfe4b03d005b6233b9" \
 -H "X-Appery-Session-Token: 6fb9515d-82fd-43b3-9124-f0534dceca8e" \
 https://api.appery.io/rest/1/db/files/544a5cdfe4b03d005b6233b9
[
    {
        "_id":"7cdec132-5d98-403e-ab37-9ea1cca96299.database_source.txt",
        "contentType":"text/plain",
        "owner":null,
        "_createdAt":"2015-06-22 16:08:31.110",
        "length":169551,
        "acl":null
    },
    {
        "_id":"31bb3831-a18e-4a3a-b720-0747a0901481.config.xml",
        "contentType":"text/xml",
        "owner":null,
        "_createdAt":"2014-07-21 12:09:49.488",
        "length":26,
        "acl":null
    },
    {
        "_id":"3f612c86-2beb-4064-bdbe-14a3d2bf0457.cta.kml",
        "contentType":"application/octet-stream",
        "owner":null,
        "_createdAt":"2014-07-21 11:59:50.108",
        "length":47667,
        "acl":null
    }
]

If the ACL for the file defines that a certain user doesn’t have read rights, the file will be excluded from the files list:

616

Now user Pete will not get this file in the list:

curl -X GET 
 -H "Content-Type: text/xml" \
 -H "X-Appery-Database-Id: 526fdbd8e4b07c3286b537f1" \
 -H "X-Appery-Session-Token: 6fb9515d-82fd-43b3-9124-f0534dceca8e" \
 https://api.appery.io/rest/1/db/files/31bb3831-a18e-4a3a-b720-0747a0901481.config.xml
{
    "status":403,
    "uri":"https://api.appery.io/rest/1/db/files/526fdbd8e4b07c3286b537f1/31bb3831-a18e-4a3a-b720-0747a0901481.config.xml",
    "response":{
        "code":"DBFG333",
        "description":"Access denied: you don't have read permission on specified object"
    }
}

By using the X-Appery-Master-Key, all the files from the Files collection will be included into the file list, despite specified ACL.