Rename a Node by Node ID

POST /ws/rest/service/v1/dm/node/rename/{node_id}

Purpose

Renames a node(folder/document) based on the node id.

Prerequisites

Ensure the following:

  • Configure the Document Manager in the shell where the node is to be renamed.
  • You must have Full permissions to use this REST service of Document Manager.

Request Format

Send a request in the following format:

Form Data (content Type: application/x-www-form-urlencoded)

data: [{"new_node_name":"rename.json","forceful":"yes" }]

Path Parameter

The following path parameter must be included in the request:

Path Parameter Required? Data Type Description
node_id Yes Integer The node (folder/document) that needs to be renamed with the specified node_id.

Request Parameters

The following parameters can be included in the request:

Request Parameter Required? Data Type Description
projectnumber Yes Integer The shell associated with the node (folder/document) that needs to be renamed.
new_node_name Yes String The new name for the specified node.
forceful No String

Determines whether to enforce the renaming. Valid values include:

"yes": Forcefully renames the nodes. If a duplicate is found, adds a suffix (1) to the file name. If the name exists, displays an error.

"no" (default)

Sample Request

To rename a folder/document with node_id 856, give the URL as below:

http://<host>:<port>/ws/rest/service/v1/dm/node/rename/856

data:[{ "new_node_name":"newname"}]

Sample Success Response

A successful response with status code 200 displays in the following format:

{

"data": [{

"Path": "/try",

"node_name_input": "newname",

"Name": "newname.pdf"

}],

"message": [{

"message": "Renamed node successfully"

}],

"status": 200

}

Sample Failed Request

The following request is sent with the new node name identical to the current name:

http://<host>:<port>/ws/rest/service/v1/dm/node/rename/856

data:[{ "new_node_name":"newname.pdf","forceful":"no"}]

Sample Failed Response

A failed response to the above request displays with status code 505 in the following format:

{

"data": [{

"Path": "/try",

"forceful": "no",

"node_name_input": "newname.pdf",

"Name": "newname.pdf"

}],

"message": [{

"message": "New node name and old node name are same"

}],

"status": 505

}

Supported Validation Messages and Status Codes

The following validation messages and status codes display in the response when incorrect values are provided in the request.

Field Name Use-case Scenario Status Code Error Message
node_id node_id is invalid. 1069 Node not found.
projectnumber Project number is invalid. 602 Project/Shell Number is not correct.
new_node_name New name is identical to the current name. 505 New node name and old node name are same.
new_node_name Rename with an existing name, and "forceful" parameter is set to "no". 1067 Cannot rename node as the name already exists.
new_node_name Name is blank / empty 505 New node name is not valid.
forceful Renames with an existing name, and forceful parameter is set to "yes". 200 Renamed node successfully.