/nfs/directory/:rootPath/:directoryPath

Rename a directory and (optionally) update its metadata.
Only authorised requests can invoke this API.

Request Header

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

Request Payload

{
    name: String,
    metadata: base64 String,
}
FieldDescription
nameThe new name of the directory.
metadataThe metadata to be associated with the directory. It should be encoded as a base64 string.

This is an optional field. If not specified, it defaults to an empty string.

Response

Ok
Unauthorized
Fields are missing

Examples

var request = require('request');

var endPoint = 'http://localhost:8100/nfs/directory/app/home';
var payload = {  
  name: 'pics',
  metadata: new Buffer('sample metadata updated').toString('base64')
};

var onResponse = function(err, response, body) {
  if (err) {
    return console.error(err.message);
  }
  if (response.statusCode === 401) {
    return console.error('Failed to authorise');
  }
  if (response.statusCode === 200) {
    return console.log('Directory Updated');
  }
  console.error('Failed to update directory.', body);
};

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