/dns

Register a long name and a service.
Only authorised requests can invoke the API.

The API will only create an empty file in the directory specified in the file path.

Request Header

Authorization: Bearer <TOKEN> 
Content-Type: application/json

Request Payload

{
    longName: 'maidsafe',
    serviceName: 'www',
    rootPath: 'app',
    serviceHomeDirPath: '/www'
}
FieldDescription
longNameThe long name to which the service is to be added.
serviceNameName of the service to be added.
rootPathRoot path of the service directory. Accepted value is app or drive.
serviceHomeDirPathThe full path of the directory that is to be associated to the service.

Response

Ok
Unauthorized
Fields are missing

Examples

var request = require('request');
var endPoint = 'http://localhost:8100/dns';

var payload = {
  longName: 'api-test',
  serviceName: 'www',
  rootPath: 'app',
  serviceHomeDirPath: '/home/website'
};

var onResponse = function(err, response, body) {
  if (err) {
    return console.error(err.message);
  }
  if (response.statusCode === 200) {
    return console.log('DNS registered successfully');
  }
  console.error('Operation failed', body);
};

request.post(endPoint, {
  auth: {
    bearer: constants.token
  },
  json: true,
  body: payload
}, onResponse);
Language
Click Try It! to start a request and see the response here!