GET by ID
Endpoint ini mengambil detail file berdasarkan ID tertentu.
Endpoint API
GET https://drive.nyanhosting.id/api/v1/file-entries/{entryId}
Parameter Query
Parameter | Tipe | Deskripsi |
---|---|---|
shareable_link | integer | ID tautan yang dapat dibagikan (opsional) |
password | string | Kata sandi untuk akses file (opsional) |
thumbnail | boolean | Mengambil thumbnail file (opsional) |
Contoh
cURL
curl -X 'GET' \
'https://drive.nyanhosting.id/api/v1/file-entries/35181?shareable_link=39&password=null&thumbnail=' \
-H 'accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
PHP (menggunakan cURL)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://drive.nyanhosting.id/api/v1/file-entries/35181?shareable_link=39&password=null&thumbnail=',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'accept: application/json',
'Authorization: Bearer YOUR_TOKEN'
]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Node.js (menggunakan axios)
const axios = require('axios');
const config = {
headers: {
'accept': 'application/json',
'Authorization': 'Bearer YOUR_TOKEN'
}
};
axios.get('https://drive.nyanhosting.id/api/v1/file-entries/35181?shareable_link=39&password=null&thumbnail=', config)
.then(response => console.log(response.data))
.catch(error => console.error(error));
Contoh Respon
{
"id": 35181,
"name": "nyandrive-logo-blue.png",
"description": null,
"file_name": "-",
"mime": "image/png",
"file_size": 29950,
"user_id": null,
"parent_id": null,
"created_at": "2025-05-12T16:23:25.000000Z",
"updated_at": "2025-05-12T16:23:25.000000Z",
"deleted_at": null,
"path": "35181",
"disk_prefix": "-",
"type": "image",
"extension": "png",
"public": false,
"thumbnail": false,
"workspace_id": 0,
"owner_id": 19,
"hash": "-",
"url": "api/v1/file-entries/35181",
"users": [
{
"email": "[email protected]",
"id": 19,
"avatar": "https://lh3.googleusercontent.com/a/ACg8ocKR18mWI7ouekc6crSkTWNVqul9XAODkGN5eiebuZuDok20WNBx=s96-c",
"model_type": "user",
"owns_entry": true,
"entry_permissions": [],
"display_name": "mrizkyhaksono"
}
],
"tags": [],
"permissions": {
"files.update": true,
"files.create": true,
"files.download": true,
"files.delete": true
}
}
Catatan: Tipe response bergantung pada header Accept yang dikirim dalam request:
Accept: image/*
akan mengembalikan file gambarAccept: application/json
akan mengembalikan metadata file dalam format JSON