Upload a file

Upload a file to your secure file transfer area.
https://dash.stannp.com/api/v1/files/upload

Parameters

file mandatory This value can be either a binary file or a URL to a file.
folder optional A folder ID for placing the file in a folder.
Request
$ curl https://dash.stannp.com/api/v1/files/upload \
-u {API_KEY}: \
-d "file=https://www.stannp.com/assets/samples/letter-heading.jpg",
-d "folder=0"
define("API_KEY","YOUR API KEY");
$postdata = http_build_query(
  array(
  	'file' => "https://www.stannp.com/assets/samples/letter-heading.jpg",
        'folder' => "0"
  )
);
$opts = array('http' => array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result = file_get_contents("https://dash.stannp.com/api/v1/files/upload?api_key=".API_KEY, false, $context);
$response = json_decode($result,true);
print_r($response);
Response
{
    "success": true,
    "data": {
        "id": "342"
    }
}

Create a folder


https://dash.stannp.com/api/v1/files/createFolder

Parameters

name mandatory The name of the folder you wish to create.
Request
$ curl https://dash.stannp.com/api/v1/files/createFolder \
-u {API_KEY}: \
-d "name=Test Folder" 
define("API_KEY","YOUR API KEY");
$postdata = http_build_query(
  array(
        'name' => "Test Folder"
  )
);
$opts = array('http' => array(
    'method'  => 'POST',
    'header'  => 'Content-type: application/x-www-form-urlencoded',
    'content' => $postdata
  )
);
$context  = stream_context_create($opts);
$result = file_get_contents("https://dash.stannp.com/api/v1/files/createFolder?api_key=".API_KEY, false, $context);
$response = json_decode($result,true);
print_r($response);
Response
{
    "success": true,
    "data": {
        "id": "342"
    }
}

List folders


https://dash.stannp.com/api/v1/files/folders

Request
$ curl https://dash.stannp.com/api/v1/files/folders?api_key={API_KEY}&offset=0&limit=100
Toggle Response
{
   "success":true,
   "data": [
        {
            "id": "2",
            "name": "test folder",
            "created": "2017-06-27 14:24:07"
        },
        {
            "id": "15",
            "name": "test folder 2",
            "created": "2017-06-27 14:26:23"
        }
    ]
}