Creates a document in a folder with the specified path.
Base Request
POST /api/documents/path[docPath]
where [docPath] is the path to the folder in which the document will be created.
Headers
Header Name | Description | Required | Values |
---|---|---|---|
Authorization | The access token | Required |
Bearer [access_token]
where [access_token] is a string generated when you complete authentication (see Getting Started) |
User-Agent | Identity of the client making the request to the server | Required |
[product]/[version]
where [product] is the name of the software you are using to make the request and [version] is the numbered version of the software (for example, MyCompanyProduct/1.0). For information on other types of values commonly included in user-agent request headers, see the User-Agent HTTP header reference section on the Mozilla developer documentation website. |
HXCS-REPOSITORY | The repository ID | Optional | Any contributed repository name. Default is default. |
Accept | The format of the data to be returned | Optional | application/vnd.hxcs.v1+json |
Content-Type | The format of the data to be posted | Optional for standard documents; required for simple blob uploads |
application/json for standard documents; multipart/form-data; boundary=[boundary_id] for simple blob uploads, where [boundary_id] is a unique string signifying each boundary between parts in a multipart upload; text/uri-list for simple blob upload parts using indirect streaming. Default is application/json. |
Content-Disposition | The format of the data to be posted in each part of a simple blob upload process | Required for simple blob uploads |
form-data; name="[upload_id]";
filename="[upload_file]"
where [upload_id] is a string matching either main for the main part of the request with a JSON content type or matching the ID of the file to be uploaded for any subsequent parts for blobs, and [upload_file] is a string matching the filename of the file to be uploaded (for example, form-data; name="1234"; filename="image1.jpg") |
Request Body
See Document for request body details. The request body follows the same structure as the response body, only the request body does not require the user or group elements.
Sample Request: Standard Document
The following is a sample request to create a standard document that does not require additional headers and elements that would be needed for a simple blob upload process. For an example that does include these additional headers and elements, see Sample Request: Simple Blob Upload.
POST /api/documents/path[docPath] Authorization: Bearer [access_token] User-Agent: MyCompanyProduct/1.0 HXCS-REPOSITORY: default Accept: application/vnd.hxcs.v1+json Content-Type: application/json { "sys_repository": "string", "sys_id": "string", "sys_primaryType": "string", "sys_title": "string", "sys_name": "string", "sys_path": "string", "sys_parentId": "string", "sys_parentPath": "string", "sys_version": 0, "sys_versionSeriesId": "string", "sys_isCheckedIn": true, "sys_isFolderish": true, "sys_isProxy": true, "sys_isTrashed": true, "sys_isVersion": true, "sys_isLatestVersion": true, "sys_mixinTypes": [ "string" ], "sys_lifecycleState": "string", "sys_pos": 0, "sys_acl": [ { "creator": "string", "permission": "string", "granted": true, "end": "2022-03-10T16:15:50Z", "begin": "2022-03-10T16:15:50Z", "status": "PENDING" } ], "sys_effectiveAcl": [ { "creator": "string", "permission": "string", "granted": true, "end": "2022-03-10T16:15:50Z", "begin": "2022-03-10T16:15:50Z", "status": "PENDING" } ], "sys_fulltextBinary": "string", "additionalProp1": {} }
Sample Request: Simple Blob Upload
The following is a sample request to create a document for a simple blob upload process. It includes examples of additional headers and elements that are not required to create a standard document, as well as a mixture of client-streamed blobs and reference URIs for indirect streaming. For request body elements common to both standard document and simple blob upload requests, see Sample Request: Standard Document.
POST /api/documents/path[docPath] Authorization: Bearer [access_token] User-Agent: MyCompanyProduct/1.0 HXCS-REPOSITORY: default Accept: application/vnd.hxcs.v1+json Content-Type: multipart/form-data; boundary=d74496d66958873e --d74496d66958873e Content-Disposition: form-data; name="main" Content-Type: application/json { "sys_repository": "string", "sys_id": "string", "sys_primaryType": "string", "sys_title": "string", ... "sysfile_blob": { "uploadId": "1234" }, "mybiz_image": { "uploadId": "5678" }, "myearth_image": { "uploadId": "9012" }, ... } --d74496d66958873e Content-Disposition: form-data; name="1234"; filename="image1.jpg" Content-Type: image/jpeg ... content of the first blob ... --d74496d66958873e Content-Disposition: form-data; name="5678"; filename="image2.gif" Content-Type: image/gif ... content of the second blob ... --d74496d66958873e Content-Disposition: form-data; name="9012"; filename="image3.jpg" Content-Type: text/uri-list # Authorization: Bearer [access_token] # Cookie: test=cookie https://www.example.com/images/earth/earth-night.jpeg --d74496d66958873e--
Response
See Document for response body details and a sample response.
Status Codes and Errors
The following table lists the returned status codes.
Code | Description | Notes |
---|---|---|
200 | OK | Creates and returns the document in a folder with the specified path. |
401 | Not Authorized | Authentication has failed or was not provided. |
403 | Not Allowed | Access permissions are invalid or missing. |
404 | Not Found | The specified folder could not be found. |