/nfs/file/metadata/:rootPath/:filePath

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

Request Header

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

Request Body

{
    name: String,
    metadata: base64 String
}
FieldDescription
nameThe new name of the file.
metadataThe metadata to be associated with the file. 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 fs = require('fs');
var endPoint = 'http://localhost:8100/nfs/file/metadata/app/home/sample.png';

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('File metadata updated');
  }
  console.error('Failed to update file metadata.', body);
};

var payload = {
  name: 'Sample.png',
  metadata: new Buffer("File metadata").toString('base64')
};

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