get https://example.com/dns//
Fetch the home directory associated with a service.
Authorised and unauthorised requests can invoke this API.
Private data can only be acquired via an authorised request. An unauthorised request will fetch the directory from the network.
Request Header
Authorization header must be passed only if the directory is private else the header should not be passed.
Authorization: Bearer <TOKEN>
Response
{
"info": {
"name": String,
"isPrivate": Boolean,
"isVersioned": Boolean,
"createdOn": Long,
"modifiedOn": Long,
"metadata": base64 String
},
"files": [],
"subDirectories": []
}
Unauthorized
Fields are missing
Field | Description |
---|---|
info.name | Name of the directory. |
info.isPrivate | Whether the directory is private or not. |
info.isVersioned | Whether the directory has version history. |
info.createdOn | Created timestamp. |
info.modifiedOn | Last modified timestamp. |
info.metadata | Metadata associated with the directory as base64 string. |
files | List of metadata related to the files in the directory. |
subDirectories | List of metadata related to the subdirectories. |
Examples
var request = require('request');
var endPoint = 'http://localhost:8100/dns/www/safenetwork';
var onResponse = function(err, response, body) {
if (err) {
return console.error(err.message);
}
if (response.statusCode === 200) {
return console.log(body);
}
console.error('Operation failed', body);
};
request.get(endPoint, {
auth: {
bearer: constants.token
}
}, onResponse);