Download descriptor or the file as attachment (tenant:dms:read)
GET /api/dms/v1/documents/{id}/download
Module: DMS · operationId: downloadDocument · Tag: Documents · Auth: access token (Authorization: Bearer <accessToken>)
Without stream it returns a JSON descriptor (file name, type, size, hash and the
downloadUrl). With stream=true it streams the current version as attachment, audited as
DOWNLOAD (same headers and errors as getDocumentContent).
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string (uuid) | yes | |
stream |
query | boolean | true streams the file instead of the descriptor (default false) |
Responses
- 200 Descriptor (JSON) or, with
stream=true, the file (application/json) - 403 With
stream=true:infected, or an encrypted document without a key for the caller (application/json) - 404 Error (
application/json) - 409 With
stream=true:not_scanned– the malware scan has not cleared the file yet (application/json) - 503 Error (
application/json)
Fields of the 200 answer:
documentId(string (uuid)): Document iddownloadUrl(string): Path that streams the filefileName(string): File name of the current versionfileSize(integer (int64)): Size in bytesmimeType(string): MIME type of the current versionsha256Hash(string): SHA-256 (hex) of the current version
Example 200 answer:
{
"documentId": "3f6c2a1e-8b4d-4c7a-9e21-5d0b7a9c1f42",
"downloadUrl": "/api/dms/v1/documents/3f6c2a1e-8b4d-4c7a-9e21-5d0b7a9c1f42/download?stream=true",
"fileName": "RE-482117.pdf",
"fileSize": 184320,
"mimeType": "application/pdf",
"sha256Hash": "5e2b8c4f1a7d3e9b0c6f2a8d4e1b7c3f9a5d0e6b2c8f4a1d7e3b9c5f0a6d2e8b"
}
Example request
curl -X GET 'https://api.mbcom.cloud/api/dms/v1/documents/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12/download' \
-H "Authorization: Bearer $ACCESS_TOKEN"