/dns/:serviceName/:longName

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
FieldDescription
info.nameName of the directory.
info.isPrivateWhether the directory is private or not.
info.isVersionedWhether the directory has version history.
info.createdOnCreated timestamp.
info.modifiedOnLast modified timestamp.
info.metadataMetadata associated with the directory as base64 string.
filesList of metadata related to the files in the directory.
subDirectoriesList 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);
Language
Click Try It! to start a request and see the response here!