Create Documents by Path

POST /ws/rest/service/v1/dm/document/create

Purpose

Add documents (files) with metadata for a particular folder. It also supports adding revisions to an existing document.

Prerequisites

Ensure the following:

Request Format

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

This is a multi-part request and all parameters must be listed before all file parts.

data: [ {"Path":"<value>",

"Name":"<value>",

"docTitle":"<value>",

"revNo":"<value>",

"issueDate":"<value>"

}]

Request Parameters

This a multi-part request and all parameters must be listed before all the file parts in the order listed below, then upload the file contents by giving the filename(with extension) in key value and select file under the value:

Request Parameter

Required?

Data Type

Description

projectnumber

No

String

The project associated with the document. Not required for company level.

Path

Yes

String

Full path where the document will be created. The folder path must exist for the document to be created.

Name

Yes

String

Name of the document to be created.

dorevise

No

String

Indicates whether to revise the file using the same file name. Valid values include: "yes", and "no" (default).

% Complete

No

Integer

The amount of work completed on that type of file/document.

Description

No

String

A description of the folder to be updated.

Note: Creation Date, Owner, Upload By, Pub No., and Size are loaded by default with appropriate values. Owner and Upload By is specifies the shell-level administrator.

Sample Request

Send an API request in the following format to create a document "ProjectDetails.doc" under "/Project Documents/Service docs" folder:

data [{"path":"/Service docs",

"fileName":"ProjectDetails.doc",

"docTitle":"project details",

"revNo":"1",

"issueDate":"06/01/2016",

<additional document attribute form properties, excluding creation date and owner>

}]

Notes:

Sample Multipart Form Request

Note: The form data body boundary in the example below is "—file upload—", but can be anything (or left unset).

-----file upload---

Content-Disposition: form-data; name="shortname"

unifier

-----file upload---

Content-Disposition: form-data; name="authcode"

MTIzMTIz

-----file upload---

Content-Disposition: form-data; name="dorevise"

yes

-----file upload---

Content-Disposition: form-data; name="projectnumber"

Shell-001

-----file upload---

Content-Disposition: form-data; name="data"

[

{"Path":"/Service docs","Name":"ProjectDetails.doc","docTitle":"project details","revNo":"1","issueDate":"06/01/2016", additional document attribute form properties, excluding creation date and owner }

]

-----file upload---

Content-Disposition: form-data; name="0"; filename="b.txt" Content-Type: text/plain

test document contents

-----file upload-----

Sample Success Request

To upload a document, export(2).doc from the local storage, to the test folder, specify a request in the following format:

projectnumber:AP

data:[{"Path":"/test","Name":"export (2).doc"}]

Sample Success Response

A successful message displays in the following format, with status code 200, when the ProjectDetails.doc document is created in the Service docs folder:

{

"data":[{

"Path":"/Service docs",

"from_object_id":"713",

"file_id":"629",

"parentId":"713",

"Name":"export (2).doc",

"node_id":"1000"

}],

"message":[{"message":"OK",

"status":200

}],

"status":200

Sample Failed Request

The following request contains a file name with invalid characters.

projectnumber:AP

data:[{"Path":"/test","Name":"<>*||.doc"}]

Sample Failed Response

A failed response displays in the following format, with status code 1045, when a parent path is not specified in the request:

{

"data": [{

"Path":"/test",

"from_object_id":"713",

"Name":"<>*||.doc"

}],

"message": [ { "message":"Invalid file name.", "status":1048 } ],

"status":1045 }

}

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

projectnumber

projectnumber is invalid.

602

Project/Shell Number is not correct.

projectnumber

projectnumber is blank and path is invalid.

1039

Invalid folder name.

Path

Path is invalid.

500

Server Error, contact system administrator.

Path

Path is blank.

1039

Parent path or node id is invalid or does not exists.

Name

File name is blank.

1054

Input required : Name

Name

Invalid Name is given(against the rules of naming).

1048

Invalid file name.

Name

Name is not specified in the data object.

1054

Input required : Name

Name

An existing name is specified (upper and lower case.)

1047

File already exists in the path.

dorevise

When random values are specified, it assumes the default value as "no".

 

 

% Complete

When random values are specified, it assumes the default value as "0".

 

 

Description

Description exceeds 4000 characters.

500

Server error.

Related Topics

Document Services

Create Documents by Parent Folder ID

Update Document's Metadata by Path

Update Document Metadata by Document ID

Get Documents by Path

Get Documents by Parent Folder ID

Get Document as Tiff File

Get Document by File ID

Search Document or Folder Properties

Rename a Node by Node ID

Rename Unpublished Document by File ID

Delete Documents by Node ID



Last Published Wednesday, April 9, 2025