Zurück zur Übersicht » REST - Document

REST - Document

REST-Interface

Get document by instance-name and cas-id (pdf-conversion)

Special method to get document from instance without any permission checks, which does only work on localhost. This logs in as ‘system’ and performs the query on the given instance.
The result is a DocumentForPdfConversion-object which contains:

This method is intended to be used for pdf-conversion!

URL
GET <application-url>/api/document/pdfconversion/<instanceName>/<documentLanguageVersionCasId>

Path parameter

Produces

application/json
application/xml

com.matterial.mtr.api.object.DocumentForPdfConversion

Permission
localhost only

Sample
GET http://localhost:8080/mtr-backend/api/document/pdfconversion/MtrDS/XXX


Get related image by instance-name and cas-id (pdf-conversion)

Special method to load files (related images) from instance without any permission checks, which does only work on localhost. This logs in as ‘system’ and performs the query on the given instance.
The result is the original file content (image).

This method is intended to be used for pdf-conversion!

URL
GET <application-url>/api/document/pdfconversion/<instanceName>/<documentLanguageVersionCasId>/file

Path parameter

Produces
File as stream

Permission
localhost only

Sample
GET http://localhost:8080/mtr-backend/api/document/pdfconversion/MtrDS/XXX/file


Get complete file by instance-name and cas-id (pdf-conversion)

Special method to get the title, abstract and main-file as html from instance without any permission checks, which does only work on localhost. This logs in as ‘system’ and performs the query on the given instance.
The result is a complete document-view as html.

This method is intended to be used for pdf-conversion!

URL
GET <application-url>/api/document/pdfconversion/<instanceName>/<documentLanguageVersionCasId>/complete

Path parameter

Produces
File as stream

Permission
localhost only

Sample
GET http://localhost:8080/mtr-backend/api/document/pdfconversion/MtrDS/XXX/complete


Get duplicate of document by id

Get duplicate of a stored document by id.
This copies the main-file and all attachments of the current version (the user is allowed to see) of all languages as temp-files.
All attachment-links within the main-file will be updated with their new temp-file equivalents.
Finally this returns all duplicated documents (one for each language) and the generated TempFileDescriptors.
You have to use the documents and the context-token of the TempFileDescriptors to store a new document.
Be aware to POST the first language and PUT the following languages with the first document-id.
URL
GET <application-url>/api/document/<documentId>/duplicate

Path parameter

Query parameter

Produces

application/json
application/xml

com.matterial.mtr.api.object.DocumentDuplicate

Permission
EDIT_DOCUMENT

Sample
GET http://localhost:8080/mtr-backend/api/document/2/duplicate


Get duplicates

Get all session-stored duplicates.
URL
GET <application-url>/api/document/duplicate

Produces

application/json
application/xml

com.matterial.mtr.api.object.DocumentDuplicates> - key of internal map: contextToken

Permission
EDIT_DOCUMENT

Sample
GET http://localhost:8080/mtr-backend/api/document/duplicate


Remove duplicate from session by context-token

Remove duplicate from session including all temp-files.
URL
DELETE <application-url>/api/document/<contextToken>/duplicate

Path parameter

Produces

text/plain

Integer - count

Permission
EDIT_DOCUMENT

Sample
DELETE http://localhost:8080/mtr-backend/api/document/ebd9dece-d065-4733-995d-6a8f22c5ba54/duplicate


Get document by id

URL
GET <application-url>/api/document/<documentId>

Path parameter

Query parameter

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/2


Get documents

URL
GET <application-url>/api/document

Query parameter

Produces

application/json
application/xml

ListResult<com.matterial.mtr.api.object.Document>

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document?limit=1&count=true


Get documents in trash (admin trash)

Get documents in trash without permission check.
URL
GET <application-url>/api/document/trash

Query parameter

Produces

application/json
application/xml

ListResult<com.matterial.mtr.api.object.Document>

Permission
SHOW_TRASH

Sample
GET http://localhost:8080/mtr-backend/api/document/trash?limit=1&count=true


Clipboard - Add by category

since 3.0.0
Add documents to clipboard by category. Optionally clear the clipboard before adding new documents. Reminder: DOCUMENT_MAX_CLIP_BOARD_SIZE is the limit for the clipboard.

URL
PUT <application-url>/api/document/clipboard/add/category/{categoryId}

Query parameter

Produces

text/plain

Integer - number of documents added to clipboard

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/clipboard/add/category/5


Clipboard - Add by category type

since 3.0.0
Add documents to clipboard by category type. Optionally clear the clipboard before adding new documents. Reminder: DOCUMENT_MAX_CLIP_BOARD_SIZE is the limit for the clipboard.

URL
PUT <application-url>/api/document/clipboard/add/category/type/{categoryTypeId}

Query parameter

Produces

text/plain

Integer - number of documents added to clipboard

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/clipboard/add/category/type/5


Clipboard - Add

Add documents to session clipboard.
URL
PUT <application-url>/api/document/clipboard/add

Consumes

application/json
application/xml

List<com.matterial.mtr.api.object.DocumentClipBoard>

Produces

text/plain

Integer - number of documents added to clipboard

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/clipboard/add


Clipboard - Remove

Remove documents from session clipboard.
URL
PUT <application-url>/api/document/clipboard/remove

Consumes

application/json
application/xml

List<com.matterial.mtr.api.object.DocumentClipBoard>

Produces

text/plain

Integer - number of documents removed from clipboard

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/clipboard/remove


Clipboard - Clear

clear all documents from session clipboard.
URL
DELETE <application-url>/api/document/clipboard

Produces

text/plain

Integer - number of documents removed from clipboard

Permission
Login

Sample
DELETE http://localhost:8080/mtr-backend/api/document/clipboard


Create snap

This interface creates a document, but compared to normal Create document this one adds:

URL
POST <application-url>/api/document/snap

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
CREATE_SNAP

Sample
POST http://localhost:8080/mtr-backend/api/document/snap


Create template

This creates a normal document, but:

URL
POST <application-url>/api/document/template

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
EDIT_DOCUMENT_TEMPLATE

Sample
POST http://localhost:8080/mtr-backend/api/document/template


Update template

This updates a template like a normal document, but:

URL
PUT <application-url>/api/document/template/<documentId>

Path parameter

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
EDIT_DOCUMENT_TEMPLATE

Sample
PUT http://localhost:8080/mtr-backend/api/document/template/2


Update bio

This updates a template like a normal document, but:

URL
PUT <application-url>/api/document/bio/<documentId>

Path parameter

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/bio/2


Create document

To activate Read Confirmation, you have to:

URL
POST <application-url>/api/document

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
EDIT_DOCUMENT

Sample
POST http://localhost:8080/mtr-backend/api/document


Update document

To activate Read Confirmation, you have to:

URL
PUT <application-url>/api/document/<documentId>

Path parameter

Query parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Document

Produces

application/json
application/xml

com.matterial.mtr.api.object.Document

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/2


Unsnap

Unsnap document: Closing related snap-task.
URL
DELETE <application-url>/api/document/<documentId>/language/<languageKey>/snap

Path parameter

Produces

text/plain

Integer - count

Permission
EDIT_TASK

Sample
DELETE http://localhost:8080/mtr-backend/api/document/8/language/fr/snap


Mark document language version as reviewed

URL
PUT <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/review

Path parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/version/3/review


Decline review of language-version

URL
PUT <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/reviewdecline

Path parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/version/3/reviewdecline


Decline review of language-version with task

The optional task should get at least the description and the assignedRoleId.
URL
PUT <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/reviewdecline

Path parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.Task

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/version/3/reviewdecline


Confirm read time

Sets the current time as confirmed read time for the current account.

URL
PUT <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/confirm

Path parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/version/3/confirm


Set additional properties

URL
PUT <application-url>/api/document/<documentId>/additionalproperty

Path parameter

Consumes

application/json
application/xml

List<[com.matterial.mtr.api.object.AdditionalProperty](/matterial/#/document/152/en)>

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/42/additionalproperty


Is following (logged-in account follows a document)

URL
GET <application-url>/api/document/<documentId>/follow

Path parameter

Query parameter

Produces

text/plain

Boolean - true / false

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/667/follow?languageKey=de


Follow document

If Query-Param accountId is not set at all, the currently logged-in account will be used. Multiple accountIds can be given to set them as followers,
but to assign other accounts as follower the caller has to have edit-permission on this document.
URL
PUT <application-url>/api/document/<documentId>/follow

Path parameter

Query parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/follow?languageKey=de


Follow document (other account)

URL
PUT <application-url>/api/document/<documentId>/follow/byaccount/<accountId>

Path parameter

Query parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/follow/byaccount/3?languageKey=de


Unfollow document

If Query-Param accountId is not set at all, the currently logged-in account will be used. Multiple accountIds can be given to unset them as followers,
but to unassign other accounts as follower the caller has to have edit-permission on this document.
URL
PUT <application-url>/api/document/<documentId>/unfollow

Path parameter

Query parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/unfollow?languageKey=de


Unfollow document (other account)

URL
PUT <application-url>/api/document/<documentId>/unfollow/byaccount/<accountId>

Path parameter

Query parameter

Produces

text/plain

Integer - count

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/unfollow/byaccount/3?languageKey=de


Archive document

URL
PUT <application-url>/api/document/<documentId>/archive

Path parameter

Query parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/archive?archivedBeginInSecondsRequest=1502284958


Unarchive document

URL
PUT <application-url>/api/document/<documentId>/unarchive

Path parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/unarchive


Trash document

URL
PUT <application-url>/api/document/<documentId>/trash

Path parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/trash


Untrash document

URL
PUT <application-url>/api/document/<documentId>/untrash

Path parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT || SHOW_TRASH

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/untrash


Finally remove document

URL
DELETE <application-url>/api/document/<documentId>

Path parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT || SHOW_TRASH

Sample
DELETE http://localhost:8080/mtr-backend/api/document/8


Remove a specific version

Removes the language-version with all its db-relations and the related cas-file. It is only possible to remove versions, that are not “currentlyInProcessing”.
URL
DELETE <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>

Path parameter

Produces

application/json
application/xml

On success: com.matterial.mtr.api.object.Document
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
DELETE http://localhost:8080/mtr-backend/api/document/8/version/25


Remove a specific language

Removes all versions of a document by language-key with all its db-relations and the related cas-files. It is not possible to remove the last language.
URL
DELETE <application-url>/api/document/<documentId>/language/<languageKey>

Path parameter

Produces

application/json
application/xml

On success: ListResult<com.matterial.mtr.api.object.Document>
On error: com.matterial.mtr.api.object.DocumentLock

Permission
EDIT_DOCUMENT

Sample
DELETE http://localhost:8080/mtr-backend/api/document/8/language/fr


Cleanup trash

URL
DELETE <application-url>/api/document

Query parameter

Produces

text/plain

Integer - count of documents placed into removal-queue

Permission
SHOW_TRASH

Sample
DELETE http://localhost:8080/mtr-backend/api/document


Get removal-queue-size

Get the current size of the removal-queue.
URL
GET <application-url>/api/document/removal/queue

Produces

text/plain

Integer - queue-size

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/removal/queue


Reconvert document-language-version

Reconverts the main-file of a document-language-version and all of its attachments. This regenerates all pdfs and thumbnails even if they already exists.
URL
PUT <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/convert

Path parameter

Produces

text/plain

Integer - count of document-language-versions

Permission
EDIT_DOCUMENT

Sample
PUT http://localhost:8080/mtr-backend/api/document/2/version/3/convert


Convert all document-language-versions

(Re)converts the main-file of all document-language-version and all of their attachments. If “regenerate=true” this regenerates all pdfs and thumbnails even if they already exists.
URL
PUT <application-url>/api/document/convert

Query parameter

Produces

text/plain

Integer - count of document-language-versions

Permission
ADMINISTRATE_ALL

Sample
PUT http://localhost:8080/mtr-backend/api/document/convert?regenerate=true


Get main-file by document-id

Load the main file of the document in markdown format..
Using the loadHtml, loadPdf and loadThumbnail parameters, you can load the desired format instead of the original format.

URL
GET <application-url>/api/document/<documentId>/file

Path parameter

Query parameter

Produces
File as stream

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/2/file?languageKey=de


Get main-file by document-id and document-language-version-id

URL
GET <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/file

Path parameter

Query parameter

Produces
File as stream

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/2/version/5/file


Compare main-files by document-language-version-ids

Compare two version of html-main-files by languageVersionId and results in a html-file which are marked with special classes (added/removed).
URL
GET <application-url>/api/document/compare/version/<oldDocumentLanguageVersionId>/<newDocumentLanguageVersionId>/file

Path parameter

Produces
File as stream

Permission
SHOW_DOCUMENT_VERSIONS_AND_COMPARE

Sample
GET http://localhost:8080/mtr-backend/api/document/compare/version/5/6/file


Get attachments

URL
GET <application-url>/api/document/<documentId>/attachment

Path parameter

Query parameter

Produces

application/json
application/xml

List<com.matterial.mtr.api.object.Attachment>

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/1/attachment


Get attachment by document-id, document-language-version-id, attachment-id

Loads the attachment in the desired format.
In case the attachment is an image, three sizes are available (the size=t and the parameter loadThumbnail have the same effect).
In case the file is a pdf or a Microsoft Office or OpenOffice format, a pdf can be loaded by setting the parameter loadPdf=true.
In case the desired file format cannot be generated, the original file format will be returned.

URL
GET <application-url>/api/document/<documentId>/version/<documentLanguageVersionId>/attachment/<attachmentId>

Path parameter

Query parameter

Produces
File as stream

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/90/version/3390/attachment/251


Get attachment by document-id, attachment-id

Loading attachment without languageVersionId
URL
GET <application-url>/api/document/<documentId>/attachment/<attachmentId>

Path parameter

Query parameter

Produces
File as stream

Permission
Login

Sample
GET http://localhost:8080/mtr-backend/api/document/90/version/3390/attachment/251


Execute batch action on clipboard

Execute batch actions defined in Batch Actions on whole clipboard.
URL
PUT <application-url>/api/document/batchaction/{actionCode}

Path parameter

Consumes

application/json
application/xml

com.matterial.mtr.api.object.BatchActionAdditionalData

Produces

text/plain

Boolean - always true, because this executes the batch action asynchronously

Permission
Login

Sample
PUT http://localhost:8080/mtr-backend/api/document/batchaction/1