Skip to main content

The Document service exhibits all the operations available around DOCUMENT type components.

Document recovery

The examples below show how to retrieve documents using the various operations of get.

Document recovery

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <IDS>: identifier of the documents to be retrieved
curl -X GET "<CORE_HOST>/rest/documents/<IDS>" \
-H "token: <TOKEN>"

Version recovery

This service allows you to retrieve a specific version of a document:

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <DOCUMENT_ID>: identifier of the document to be retrieved
# <VERSION_ID>: identifier of the version to be retrieved
curl -X GET "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/versions/<VERSION_ID>" \
-H "token: <TOKEN>"

Retrieving associated files

This service retrieves the files associated with the document whose identifier is passed as input:

  • the content: includeContent = true
  • files: includeContent = false
# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <ID>: document identifier
# <INCLUDE_CONTENT>: true or false for content retrieval
curl -X GET "<CORE_HOST>/rest/documents/<ID>/files?includeContent=<INCLUDE_CONTENT>" \
-H "token: <TOKEN>"

Document creation

The examples below show how to create documents using the following operation.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
curl -X POST "<CORE_HOST>/rest/documents/" \
-H "token: <TOKEN>" \
-H "Content-Type: application/json" \
-d '[
{
"data": {
"classId": "Document"
},
"category": "DOCUMENT",
"name": "D1"
}
]'

Document creation with a content

The examples below show how to create a document with its content using the following operation.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
curl -X POST "<CORE_HOST>/rest/documents/unique" \
-H "token: <TOKEN>" \
-F "file=@/path/to/file" \
-F 'document=[
{
"data": {
"classId": "Document"
},
"category": "DOCUMENT",
"name": "D1"
}
];type=application/json'

Document modification

The examples below show how to update documents.

Document modification with content replacement

This operation allows to modify the data of a document (class identifier, document name, ACL, etc.) as well as modifying its content in the same call.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <ID>: document identifier
curl -X POST "<CORE_HOST>/rest/documents/<ID>/unique" \
-H "token: <TOKEN>" \
-F "file=@/path/to/file" \
-F 'document=[
{
"data": {
"classId": "Document"
},
"category": "DOCUMENT",
"name": "D1"
}
];type=application/json'

Data modification

This operation updates a document's tags and data (class identifier, document name, ACL, etc.) but also its content.

info

This service operates on a cancel and replace basis, so all the contents and tag values must be supplied by the service at the time of update. It is therefore advisable to retrieve the document, make the changes and call the update service.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <ID>: document identifier
curl -X POST "<CORE_HOST>/rest/documents/<ID>" \
-H "token: <TOKEN>" \
-H "Content-Type: application/json" \
-d '[
{
"files": [
{
"id": "98c1f765-7595-46c3-8f4a-b75bd7c25ff7",
"size": 0
}
],
"data": {
"classId": "Document"
},
"category": "DOCUMENT",
"name": "D2"
}
]'

Add file

This operation adds content to a document

  • replace: replaces the existing file with the new content
# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <ID>: document identifier
# <REPLACE>: true or false to replace content
curl -X POST "<CORE_HOST>/rest/documents/<ID>/files?replace=<REPLACE>" \
-H "token: <TOKEN>" \
-F "file=@/path/to/file"

Rename file

This operation allows you to rename a file associated with a document:

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <ID>: document identifier
# <FILE_ID>: file identifier
curl -X POST "<CORE_HOST>/rest/documents/<ID>/files/<FILE_ID>/name" \
-H "token: <TOKEN>" \
-d "<NEW_FILE_NAME>"

Search document

The search operations all work on the same model as described here.

Document deletion

The examples below show how to delete documents.

Document deletion

This operation allows to delete the document and its associated files.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <IDS>: identifiers of documents to be deleted
curl -X DELETE "<CORE_HOST>/rest/documents/<IDS>" \
-H "token: <TOKEN>"

File deletion

This operation allows you to delete a file.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <DOCUMENT_ID>: document identifier
# <FILE_ID>: content identifier to be deleted
curl -X DELETE "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/files/<FILE_ID>" \
-H "token: <TOKEN>"

Content

Content recovery

This service retrieves the content associated with the file whose identifier is passed as input:

  • with or without obfuscations, depending on the parameter includeObfuscations
# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <DOCUMENT_ID>: document identifier
# <FILE_ID>: content identifier
# <INCLUDE_OBFUSCATIONS>: true or false to include obfuscations
curl -X GET "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/files/<FILE_ID>/content?includeObfuscations=<INCLUDE_OBFUSCATIONS>" \
-H "token: <TOKEN>"

Index document content

This service indexes the content passed in parameter and associated with the file identifier.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <DOCUMENT_ID>: document identifier
# <FILE_ID>: content identifier
curl -X POST "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/files/<FILE_ID>/content/index" \
-H "token: <TOKEN>" \
-H "Content-Type: application/json" \
-d "document content"

Remove content indexing from a document

This service removes the indexing of content associated with a document.

# <CORE_HOST>: FlowerDocs Core base URL
# <TOKEN>: authentication token
# <DOCUMENT_ID>: document identifier
# <FILE_ID>: content identifier
curl -X DELETE "<CORE_HOST>/rest/documents/<DOCUMENT_ID>/files/<FILE_ID>/content/index" \
-H "token: <TOKEN>"
warning

This service removes indexing from all files associated with the document.