Rename Unpublished Document by File ID
POST /ws/rest/service/v1/dm/node/rename/unpublished/{file_id}
Purpose
Renames an unpublished document based on the file ID.
Prerequisites
Ensure the following:
- Configure the Document Manager in the shell where the document is to be retrieved.
- You must have Full permissions to use this REST service of Document Manager.
Request Format
Specify the request in the following format:
Form Data (content Type: application/x-www-form-urlencoded)
data: [{"new_node_name":"rename.json",
"forceful":"yes"
}]
Path Parameters
The following path parameters must be included in the request:
| Request Parameter | Required? | Data Type | Description |
|---|---|---|---|
| projectnumber | Yes | String | The shell associated with the node (document) that needs to be renamed. |
| file_id | Yes | String | The unpublished node(document) with this unique ID that needs to be renamed. |
Request Parameters in data JSON Object
The following request parameters can be included in the data [] of the request:
| Request Parameter | Required? | Data Type | Description |
|---|---|---|---|
| new_node_name | Yes | String | The new name of 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) |
Response Format
A JSON object is returned in the following format.
{
"data": [],
"message": [],
"status": <REST status code value>
}
A successful response displays a status code 200.
A failed response displays a message with a status code.
Sample Request
To rename an unpublished document with file_id 409, specify the following URL and data object:
http://<host>:<port>/ws/rest/service/v1/dm/node/rename/unpublished/409
data: [{"new_node_name":"renamefile.xlsx",
"forceful":"yes"
}]
Sample Success Response
A successful response is returned with status 200 in the following format:
{
"data": [{
"Path": "",
"node_name_input": "just.xlsx",
"Name": "just.xlsx"
}],
"message": [{
"message": "Renamed unpublished document successfully"
}],
"status": 200
}
Sample Failed Response
A failed response for a name that already exists is returned with status 505 in the following format:
{
"data": [{
"Path": "",
"forceful": "yes",
"node_name_input": "renamep.xlsx",
"Name": "renamep.xlsx"
}],
"message": [
{"message": "New file name and old file 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 |
|---|---|---|---|
| file_id | file_id is invalid. | 505 | Unpublished document not found in the current project. |
| 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. |
| nodetype | nodetype value is not valid. | 1049 | Invalid 'nodetype', please provide either 'document' or 'folder'. |
| forceful | Renames with an existing name, and forceful parameter is set to "yes". | 200 | Renamed node successfully. |