Get home directory

Fetch the home directory associated with a service.

Authorized and unauthorized requests can invoke this endpoint, but private data can only be acquired via an authorized request.

Request

GET /dns/:serviceName/:longName

URL

Parameter Description
serviceName The service name for which the home directory has to be fetched.
longName The long name associated with the service that contains the home directory.
Example
http://localhost:8100/dns/www/example
Field Description
Authorization The authorization token obtained from SAFE Launcher.
Example
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Im5RT1poRFJ2VUFLRlVZMzNiRTlnQ25VbVVJSkV0Q2lmYk4zYjE1dXZ2TlU9In0.OTKcHQ9VUKYzBXH_MqeWR4UcHFJV-xlllR68UM9l0b4

Response

On success, the HTTP status code in the response header is 200 (OK).

Body

Property Description
info.name Name of the directory.
info.metadata Metadata associated with the directory (encoded as a base64 string).
info.isPrivate Whether the directory is private or public.
info.isVersioned Whether the directory has version history.
info.createdOn Created timestamp (ISO 8601).
info.modifiedOn Last modified timestamp (ISO 8601).
subDirectories List of metadata related to the subdirectories.
files List of metadata related to the files in the directory.
Example
{
    "info": {
        "name": "example",
        "metadata": "test",
        "isPrivate": false,
        "isVersioned": false,
        "createdOn": "2016-09-27T05:14:52.528Z",
        "modifiedOn": "2016-09-27T05:14:52.528Z"
    },
    "subDirectories": [],
    "files": []
}

Example

var request = require('request');
var endpoint = 'http://localhost:8100/dns/www/example';

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);

results matching ""

    No results matching ""