Create document

Requirements

  • Authentication token

How to:

1. Create an eDoc document

POST /documents?token=:authenticationToken
  • Creates new eDoc document and configures basic information.
  • eDoc document is composed from html template specified by document type and user inputs.
  • You have to choose document type and workflow definition.
  • To put the document into the folder, you have to specify folder ID.

Example

Request

POST /documents?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
    "body": {
        "documentType": "d_integration",
        "documentTitle": "My Document",
        "myField": "Custom value" //definition specific field value
    },
    "definitionType": "edoc",
    "workflow": "wf_generic",
    "optionalData": {
        "folder": "02a9cce1-e63d-47e0-b721-952df1992c45" //where to put the document
}

Response

{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb766"
}
  • Response object contains the Document ID of newly created document: d148b19a-4fa9-442e-adfd-7aa68b8eb766

2. Create a document from existing file

POST /documents?token=:authenticationToken
  • Creates new document from existing file and configures basic information.
  • You have to create the file first and then use its file hash.
  • You have to choose definition typedocument type and workflow definition.
  • To put the document into the folder, you have to specify folder ID.

Example

Request

POST /documents?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
    "body": {
        "documentType": "d_integration",
        "documentTitle": "My Document",
        "pdfFile": {
            "content": "w3buldjaekdrigei0uaz8yahmfc1f90cco67wykfuja48uqgi60anzex9lw42sfl"   //specify existing file hash
        }
    },
    "definitionType": "ext",
    "workflow": "wf_generic",
    "optionalData": {
        "folder": "02a9cce1-e63d-47e0-b721-952df1992c45" //where to put the document
}

Response

{
    "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb766"
}
  • Response object contains the Document ID of newly created document: d148b19a-4fa9-442e-adfd-7aa68b8eb766

3. Add attachment to the document

NoneBashCSSCC#HTMLJavaJavaScriptJSONPHPPowershellPythonRubyTypeScriptCopy

POST /attachments/:documentType/:documentId?token=:authenticationToken
  • Adds attachment to already existing document.
  • You have to upload the file first and then use gained file hash.

Example

Request

POST /attachments/d_integration/d148b19a-4fa9-442e-adfd-7aa68b8eb766?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
    "fileHash": "9pd45smja4asdxa4w5a7u8dasd4wa6",
    "document_name": "Document attachment",
    "file_type": "upload", // "upload" or "scan"
    "document_type": "Letter",
    "description": "Document letter"
}

Response

  • No response, only status 200.

4. Add label to the document

POST /tags/set/document?token=:authenticationToken
  • Adds new label (tag) to existing document.
  • You can specify both private and public labels.

Example

Request

POST /tags/set/document?token=ADFFQBYXP2NVGR6PAP3KOR27FETP6
{
    "data": [ //specify at least one document
        {
            "id": "d148b19a-4fa9-442e-adfd-7aa68b8eb766"
        }
    ],
    "tags": { //specify at least one tag
        "private": [ "Private tag", "Another tag" ],
        "public": [ "Public tag" ]
    }
}

Response

{
    "errors": "false",
    "count": 1, //One document updated
    "items": [] //Only in case of errors
}