Skip to content

Manage Documents and Collections


Data Type

You can manage documents and collections by specifying document as <dataType> in the SEAL OP-CLI call:

opcli document <command> <option>

Display the Options and Parameters

By specifying the --help option, you get the available options and parameters for the document data type:

opcli document --help

Create a Document or a Collection

With the create command, you create a document or a collection:

opcli document create <name> [--type <type>] [--collection <collectionID>] [--metadata <metadata>] [--owner <owner] [--service-id <serviceId]
  • <name>: Name of the document or collection; mandatory

  • --type <type>: Type of the object to be created; available values: document, collection; default: document

  • --collection <collectionId>: ID of the folder in which the document is to be created

  • --metadata <metadata>: Metadata in JSON syntax, for example, '{"status":"new", "origin":"system"}'

  • --owner <owner>: Account name of the user who is to be the owner of the task

  • --service-id <serviceId>: Type of the connector for storing the document; available values: operator-fileupload and other connectors possibly configured in SEAL Operator; default: operator-fileupload

Example - create a document named Test for the operator-fileupload connector with the status and origin metadata"

opcli document create Test --metadata '{"status":"new", "origin":"system"}'

Example - create a document named MyDocument in the subfolder specified by <collectionId>

opcli document create MyDocument --collection <collectionId>

Example - create a subfolder with the name MyCollection

opcli document create MyCollection --type collection

Get the Metadata of a Document or a Collection

With the get command, you get the metadata of a document or a collection. The metadata are output as JSON object on STDOUT.

opcli document get <documentId> [--service-id <serviceId]
  • <documentId>: ID of the document or collection; mandatory

    Hint - id

    The document or collection ID is the value of the id setting and output when the document or collection is created, for example, "id":"a2b9bb1b-9b8c-4df2-9b8b-0550aa16770e".

  • --service-id <serviceId>: Type of the connector for storing the document or collection; available values: operator-fileupload and other connectors possibly configured in SEAL Operator; default: operator-fileupload

Example - get the metadata of the document with the ID a9d7c323-15f6-44d7-ae5e-328b736a4e7b

opcli document get a2b9bb1b-9b8c-4df2-9b8b-0550aa16770e

Replace or Delete the Metadata of a Document or a Collection

With the replace-meta command, you replace the metadata of a document or a collection. The existent metadata are deleted and the specified metadata are set. For deleting the existent metadata, specify an empty JSON object as metadata.

opcli document replace-meta <documentId> --file <file>|--metadata <metadata> [--service-id <serviceId]
  • <documentId>: ID of the document or the collection; mandatory

  • --file <file>: Path and name of a file containing the new metadata as JSON object

  • --metadata <metadata>: New metadata in JSON syntax, for example, `'{"status":"obsolete"}'``

  • --service-id <serviceId>: Type of the connector for storing the document or the collection; available values: operator-fileupload and other connectors possibly configured in SEAL Operator; default: operator-fileupload

Example - replace the metadata of the document by the metadata specified as option

opcli document replace-meta a9d7c323-15f6-44d7-ae5e-328b736a4e7b --metadata '{"status":"obsolete"}'

Example - replace the metadata of the document by the metadata specified in the metadata.json file

opcli document replace-meta a9d7c323-15f6-44d7-ae5e-328b736a4e7b --file metadata.json

Example - delete the metadata of the document

opcli document replace-meta a9d7c323-15f6-44d7-ae5e-328b736a4e7b --metadata '{}'

Upload a File to a Document

With the upload-file command, you upload a file to a document:

opcli document upload-file <documentId> <fileName> [--service-id <serviceId]
  • <documentId>: ID of the document; mandatory

  • <fileName>: Path and name of the file to be uploaded and assigned to the document; mandatory

  • --service-id <serviceId>: Type of the connector for storing the document; available values: operator-fileupload and other connectors possibly configured in SEAL Operator; default: operator-fileupload

Example - upload the test.pdf file to the specified document

opcli document upload-file a9d7c323-15f6-44d7-ae5e-328b736a4e7b test.pdf

Back to top