Update Document Metadata by Document ID

POST /ws/rest/service/v1/dm/document/update/<document_node_id>

Purpose

Modifies the metadata for a particular document using the node id.

Prerequisites

Ensure the following:

  • Configure the Document Manager in the shell where the document is to be updated in a folder.
  • You must have Update permissions to use this REST service of Document Manager.
  • Create the folder and the document before you upload the document.

Request Format

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

Path Parameter

Ensure you follow the order given below for path and request parameters while providing the request, then upload the file contents by giving the file name (with extension) in key value and select file under the value.

Specify the following path parameter:

Request Parameter Required? Data Type Description
node_id Yes Integer The node id to be updated. Use the Get Folders or Documents Metadata by Path REST service to get the node_id.

Use the Get Folders or Documents Metadata by Path REST Service to get the node_id value for the document.

Request Parameters in data JSON Object

The data JSON object is a required object. It contains a List of field and values for the Document Attribute Form. The following parameters can be included in this object:

Request Parameter Required? Data Type Description
Description No String A description about the document to be updated.
Name No String The name to be used for renaming the document.
Title No String The title of the document.
revNo. No Integer The revision number of the file when it is duplicated with the same file name.
issueDate No Date The date on which the document was originally issued.
%Complete No Integer The amount of work completed on that type of file/document.

Note:

The following optional fields are loaded by default with appropriate values: Creation Date, Owner, Upload By, Pub No., and Size.

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 update a document in node ID 1011, send a request in the following format:

http://<host>:<port>/ws/rest/service/v1/dm/document/update/1011

data:[{"Title":"Important",

"Description":"Output File",

"Revision No.":"1",

"% Complete":"50",

"Issue Date":"02/02/2024 12:00 AM"}]

Use the GET call to get the structure of the JSON data.

Sample Success Response

For the above request, the REST service returns a successful response with status code 200 in the following format:

{

"data":[{"Path":"/testing/trial.pdf",

"Revision No.":"1",

"Description":"Output File",

"Title":"Important",

"Issue Date":"02/02/2024 12:00 AM",

"% Complete":"50"} ],

"message": [ { "message":"OK" } ],

"status":200

}

Sample Failed Request

A non-existent node_id is specified in the following request:

http://<host>:<port>/ws/rest/service/v1/dm/document/update/10115

data:[{"Title":"Sample Document","Description":"Describes the test"}]

Note:

The Document ID is provided as a part of the path parameter.

Sample Failed Response

When an invalid Document ID is specified in the above request, a failed response displays in the following format with status code 1039:

{

"data": [ "Description":"Describes the test",

"Title":"Sample Document"} ],

"message": [ { "message":"Parent path or node id is invalid or does not exists." } ],

"status":1039

}

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. 1039 Parent path or node id is invalid or does not exists.
node_id node_id is blank. 500 Server Error, Contact System Administrator
Description Description exceeds 4000 characters. 505  
Name File name is blank or just the file extension is specified. 505 New file name is not valid.
Name Invalid Name is given(against the rules of naming). 1048 Invalid file name.
Name Existing folder name is duplicated(upper or lower case).   (appends (1) to the name and updates.)
Name Name is a read-only field. 505 Cannot rename as the node_name field is readonly.
Name Document is locked. 505 Cannot rename locked node.
Name File extension is changed. 505 File extension cannot be changed.
Name Current name is specified as the new name. 505 New node name and old node name are same.
Title Title exceeds 250/2000 characters. 505  
Revision No. Revision No. exceeds 250/2000 characters. 505  
Issue Date Date is invalid.    
% Complete Characters are specified. 200 In UI, characters are not reflected instead "0" is kept.