API

Folder

Create

URL: http(s)://alfafile.net/api/v1/folder/create
Description: Create a folder.
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • name - The name of the folder to be created
Optional params:
  • folder_id - The key that identifies the folder. If the folder_id is not passed, will return the root folder details
Request example: /api/v1/folder/create?name=TestFolder&folder_id=7&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "folder":{
            "folder_id":"E",
            "mode":1,
            "mode_label":"Public",
            "parent_folder_id":"7",
            "name":"TestFolder",
            "url":"http:\/\/alfafile.net\/folder\/E",
            "nb_folders":0,
            "nb_files":0,
            "created":1426763963
        }
    },
    "status":200,
    "details":null
}
        
    
Error response example:
        
{
    "response":null,
    "status":409,
    "details":"Conflict. Folder with the same name already exists"
}
        
    

Info

URL: http(s)://alfafile.net/api/v1/folder/info
Description: Returns a folder's and list of sub folders details
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
Optional params:
  • folder_id - The key that identifies the folder. If the folder_id is not passed, will return the root folder details
Request example: api/v1/folder/info?folder_id=7&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "folder":{
            "folder_id":"7",
            "mode":2,
            "mode_label":"Private",
            "parent_folder_id":null,
            "name":"MyFiles",
            "url":"http://alfafile.net/folder/7",
            "nb_folders":1,
            "nb_files":2,
            "created":1426762098,
            "folders":[
                {
                    "folder_id":"E",
                    "mode":1,
                    "mode_label":"Public",
                    "parent_folder_id":"7",
                    "name":"TestFolder",
                    "url":"http://alfafile.net/folder/E",
                    "nb_folders":"0",
                    "nb_files":"0",
                    "created":1426763963
                }
            ]
        }
    },
    "status":200,
    "details":null
}
        
    
Error response example:
        
{
    "response":null,
    "status":404,
    "details":"Folder with folder_id: '7c' doesn't exist"
}
        
    

Content

URL: http(s)://alfafile.net/api/v1/folder/content
Description: Returns a folder's, list of sub folders and list of files details
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
Optional params:
  • folder_id - The key that identifies the folder. If the folder_id is not passed, will return the root folder details
  • page - Page number. Default is 1
  • per_page - Number of files per page. Default is 500
  • sort_column - Sort column name. Possible values: 'name', 'created', 'size', 'nb_downloads'. Default is 'name'
  • sort_direction - Sort direction. Possible values: 'ASC', 'DESC'. Default is 'ASC'
Request example: api/v1/folder/content?folder_id=7&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "folder":{
            "folder_id":"7",
            "mode":2,
            "mode_label":"Private",
            "parent_folder_id":null,
            "name":"MyFiles",
            "url":"http:\/\/alfafile.net\/folder\/7",
            "nb_folders":1,
            "nb_files":2,
            "created":1426762098,
            "folders":[
                {
                    "folder_id":"E",
                    "mode":1,
                    "mode_label":"Public",
                    "parent_folder_id":"7",
                    "name":"TestFolder",
                    "url":"http:\/\/alfafile.net\/folder\/E",
                    "nb_folders":"0",
                    "nb_files":"0",
                    "created":1426763963
                }
            ],
            "files":[
                {
                    "file_id":"GA",
                    "mode":1,
                    "mode_label":"Public",
                    "folder_id":"7",
                    "name":"file2.png",
                    "hash":"0a9efe3280143218fa9bad5e36bd3d81",
                    "size":15128,
                    "url":"http:\/\/alfafile.net\/file\/GA",
                    "created":1426764695,
                    "nb_downloads": 0
                },
                {
                    "file_id":"Gu",
                    "mode":1,
                    "mode_label":"Public",
                    "folder_id":"7",
                    "name":"file1.zip",
                    "hash":"03a8b5ceb55d9be5ec57aea62d6628d6",
                    "size":2010338,
                    "url":"http:\/\/alfafile.net\/file\/Gu",
                    "created":1426764700,
                    "nb_downloads": 0
                }
            ]
        },
        "pager": {
            "current": 1,
            "total": 1
        }
    },
    "status":200,
    "details":null
}
        
    

Rename

URL: http(s)://alfafile.net/api/v1/folder/rename
Description: Rename a folder.
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • name - The new name of the folder
  • folder_id - The key that identifies the folder to be renamed
Optional params:
Request example: /api/v1/folder/rename?name=TestFolderRenamed&folder_id=E&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "folder":{
            "folder_id":"E",
            "mode":1,
            "mode_label":"Public",
            "parent_folder_id":"7",
            "name":"TestFolderRenamed",
            "url":"http://alfafile.net/folder/E",
            "nb_folders":0,
            "nb_files":0,
            "created":1426763963
        }
    },
    "status":200,
    "details":null
}
        
    

Copy

URL: http(s)://alfafile.net/api/v1/folder/copy
Description: Copy a folder to another folder (This operation also works with foreign folders).
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • folder_id_dest - The key that identifies the destination folder
  • folder_id - The key that identifies the folder. You can also specify multiple folder keys separated by comma
Optional params:
Request example: /api/v1/folder/copy?folder_id=n&folder_id_dest=E&token=&&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "result":{
            "success":1,
            "success_ids":[
                "n"
            ],
            "fail":0,
            "fail_ids":[

            ],
            "errors":[

            ]
        }
    },
    "status":200,
    "details":null
}
        
    
Error response example:
        
{
    "response":{
        "result":{
            "success":0,
            "success_ids":[

            ],
            "fail":1,
            "fail_ids":[
                "y"
            ],
            "errors":[
                "Conflict. Folder with the same name already exists in destination folder"
            ]
        }
    },
    "status":200,
    "details":null
}
        
    

Move

URL: http(s)://alfafile.net/api/v1/folder/move
Description: Move a folder to another folder (This operation also works with foreign folders).
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • folder_id_dest - The key that identifies the destination folder
  • folder_id - The key that identifies the folder. You can also specify multiple folder keys separated by comma
Optional params:
Request example: /api/v1/folder/move?folder_id=n&folder_id_dest=E&token=&&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "result":{
            "success":1,
            "success_ids":[
                "n"
            ],
            "fail":0,
            "fail_ids":[

            ],
            "errors":[

            ]
        }
    },
    "status":200,
    "details":null
}
        
    
Error response example:
        
{
    "response":{
        "result":{
            "success":0,
            "success_ids":[

            ],
            "fail":1,
            "fail_ids":[
                "y"
            ],
            "errors":[
                "Conflict. Folder with the same name already exists in destination folder"
            ]
        }
    },
    "status":200,
    "details":null
}
        
    

Delete

URL: http(s)://alfafile.net/api/v1/folder/delete
Description: Delete a folder.
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • folder_id - The key that identifies the folder. You can also specify multiple folder keys separated by comma
Optional params:
Request example: /api/v1/folder/delete?folder_id=n,y&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "result":{
            "success":2,
            "success_ids":[
                "n",
                "y"
            ],
            "fail":0,
            "fail_ids":[

            ],
            "errors":[

            ]
        }
    },
    "status":200,
    "details":null
}
        
    

Change mode

URL: http(s)://alfafile.net/api/v1/folder/change_mode
Description: Change a folder mode.
Method: (GET|POST)
Required params:
  • token - Access Token to authenticate the user's current session
  • folder_id - The key that identifies the folder
  • mode - New folder mode
Optional params:
Possible values of the Mode property:
  • 1 - Public
  • 2 - Private
  • 3 - Hot
Request example: /api/v1/folder/change_mode?folder_id=E&mode=2&token=arsd4h37ecfkdqd16uolf5nai1
Success response example:
        
{
    "response":{
        "folder":{
            "folder_id":"E",
            "mode":"2",
            "mode_label":"Private",
            "parent_folder_id":"7",
            "name":"TestFolderRenamed",
            "url":"http:\/\/alfafile.net\/folder\/E",
            "nb_folders":0,
            "nb_files":0,
            "created":1426763963
        }
    },
    "status":200,
    "details":null
}