POST
/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documentsCreate a DMS document
Code samples
# You can also use wget
curl -X POST /api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents \
-H 'Content-Type: multipart/form-data' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
POST /api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents HTTP/1.1
Content-Type: multipart/form-data
Accept: application/json
const inputBody = '{
"file": "string",
"name": "New Document",
"description": ""
}';
const headers = {
'Content-Type':'multipart/form-data',
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post '/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post('/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'multipart/form-data',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"multipart/form-data"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "/api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /api/v2/clients/{client_id}/dms/projects/{project_id}/folders/{folder_id}/parent/{parent_uuid}/documents
Creates a new DMS document in the specified project and DMS folder.
Body parameter
file: string
name: New Document
description: ""
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| client_id | path | integer | true | Client ID |
| project_id | path | integer | true | Project ID |
| folder_id | path | integer | true | Folder ID |
| parent_uuid | path | string | true | task/subproject UUID |
| body | body | object | true | Document data |
| » file | body | string(binary) | true | File. Allowed mime types: image/, application/, text/, video/ |
| » name | body | string | true | Document name |
| » description | body | string | false | none |
Example responses
201 Response
{
"status": "success",
"code": 201,
"message": "Document successfully created",
"details": {
"id": 42,
"projectId": 5,
"folderId": 42,
"parentUuid": "550e8400-e29b-41d4-a716-446655440001",
"name": "Internal documents",
"description": "Folder for internal documents",
"fileSize": 512,
"createdAt": "2022-12-01T08:30:00",
"createdUserId": 7,
"createdUserName": "John Doe"
}
}
401 Response
{
"status": "error",
"code": 401,
"message": "Authentication failed",
"details": "JWT token not found"
}
403 Response
{
"status": "error",
"code": 403,
"message": "Access denied",
"details": "Insufficient permissions"
}
404 Response
{
"status": "error",
"code": 404,
"message": "Not found",
"details": "The requested resource was not found"
}
500 Response
{
"status": "error",
"code": 500,
"message": "Internal server error",
"details": "An internal server error occurred"
}
Responses
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Document created | Inline |
| 401 | Unauthorized | Authentication error (JWT token missing/invalid) | ErrorResponse |
| 403 | Forbidden | Access denied (insufficient permissions) | ErrorResponse |
| 404 | Not Found | Resource not found | ErrorResponse |
| 500 | Internal Server Error | Internal server error | ErrorResponse |
Response Schema
Status Code 201
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » status | string | false | none | none |
| » code | integer | false | none | none |
| » message | string | false | none | none |
| » details | DmsDocumentItem | false | none | none |
| »» id | integer | true | none | Unique folder ID |
| »» projectId | integer | true | none | Project identifier |
| »» folderId | integer | true | none | Parent DMS folder ID |
| »» parentUuid | string(uuid) | true | none | Parent task/subproject UUID |
| »» name | string | true | none | Folder name |
| »» description | string¦null | false | none | Folder description |
| »» fileSize | integer | false | none | File Size |
| »» createdAt | string(date-time) | false | none | Creation timestamp |
| »» createdUserId | integer | false | none | ID of the creating user (-1 if unknown) |
| »» createdUserName | string | false | none | Name of the creating user |
