Uploading a File

You can use the uploadFile call to upload a file.

Sample URL

https://hostname:port/context/rest/v2/documents/uploadFile?BrowserXfer=Y&TransferDirection=upload

Method

POST

Parameters

uploadFile is a HTML form based multipart/form-data POST. The following parameters are part of the multipart/form-data posted data:

Parameter Description
dateModified Optional.

An integer representation of the time when the file is modified on the client. The default value is the database time.

comments Optional.

Comments on the file.

parentId Optional.

The document ID of the parent. The default value is the root folder.

path Optional.

The full file path.

The parentId parameter is ignored if this parameter is present.

The file name and the file content are sent with HTML form input field: <input file="files[]">.

Response

HTTP Status Code Description
200 The call is executed successfully.

Example:

{"files":[{"id":"13AP000007D4","latestVersion":3,"parentId":"13AH00000004","dateModified":1383148786071, "users":"O:ian:A","lastUpdatedBy":"ian","name":"Jellyfish.jpg","type":"F","size":775702}]}

200 If an error occurs for uploading a file, the error status and error message are included in the response file JSON object.

Example:

{"files":[{"id":"13AP000007D4","status":"496","error":"File extension is not allowed", "name":"Dangers.exe","....}]}