Fetch the metadata of a file.
Only authorised requests can invoke this API.
Definition
http://localhost:8100/0.5/nfs/file/:rootPath/:filePath
Parameters
Name | Description |
---|---|
rootPath (required) | string Accepted value - app or drive |
filePath (required) | string Full path of the file |
Documentation
Request Header
Authorization: Bearer <TOKEN>
Response
The API returns the metadata of the file.
Response Headers:
"accept-ranges": "bytes"
"content-length": "175786"
"created-on": "2016-01-18T00:21:05.210Z"
"last-modified": "2016-01-18T00:21:05.212Z"
"metadata": "RmlsZSBtZXRhZGF0YQ=="
Reponse Body:
Binary data
Unauthorized
Fields are missing
Invalid Range
Header Field | Description |
---|---|
content-length | Actual size of the file. |
created-on | Created time as ISO String. |
last-modified | Last modified time as ISO String. |
metadata | Metadata related to the file. |
Examples
var request = require('request');
var endPoint = 'http://localhost:8100/nfs/file/app/pics/sample.png';
var onResponse = function(err, response, body) {
if (err) {
return console.error(err.message);
}
if (response.statusCode === 200) {
return console.log(JSON.stringify(response.headers));
}
console.error('Failed', body);
};
request.head(endPoint, {
auth: {
bearer: constants.token // pass auth token
}
}, onResponse);