API Documentation

Upload File Using API

To upload a file using the NeoDrive API, send a POST request with the following parameters:

cURL Request
curl --location --request POST 'https://neodriveURL/api' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode '[email protected]' \
--data-urlencode 'api_token=your_api_key' \
--data-urlencode 'url=FileID'
                    
PHP Request
<?php
$data = array(
    'email' => '[email protected]',
    'api_token' => 'your_api_key',
    'url' => 'FileID'
);

$options = array(
    'http' => array(
        'header'  => "Content-Type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',
        'content' => http_build_query($data),
    ),
);

$context  = stream_context_create($options);
$response = file_get_contents('https://neodriveURL/api', false, $context);
$response_data = json_decode($response, true);

if ($response_data['status']) {
    echo "Upload successful. File URL: " . $response_data['data']['url'];
} else {
    echo "Error: " . $response_data['message'];
}
?>
                    
Response

The API will return the following JSON response:

{
    "status": true,
    "code": 200,
    "message": "Upload successful",
    "data": {
        "name": "FileName.mp4",
        "url": "https://neodriveURL/file/UniqueID",
        "share_id": "UniqueID"
    }
}
                    

In this response:

  • status: Whether the upload was successful (true or false).
  • code: HTTP status code.
  • message: A human-readable message.
  • data: Contains the file details:
    • name: The name of the uploaded file.
    • url: The URL to access the file.
    • share_id: A unique identifier for sharing the file.