put https://example.com/dns
Add a service to a registered long name.
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: 'blog',
rootPath: 'app',
serviceHomeDirPath: '/blog'
}
Field | Description |
---|---|
longName | The long name to which the service is to be added. |
serviceName | Name of the service to be added. |
rootPath | Root path of the service directory. Accepted value is app or drive . |
serviceHomeDirPath | The 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: 'safenetwork',
serviceName: 'blog',
serviceHomeDirPath: '/home',
rootPath: 'app'
};
var onResponse = function(err, response, body) {
if (err) {
return console.error(err.message);
}
if (response.statusCode === 200) {
return console.log('Service added successfully');
}
console.error('Operation failed', body);
};
request.put(endPoint, {
auth: {
bearer: constants.token
},
json: true,
body: payload
}, onResponse);