api/v1/docForm

DocForm represents documents in the elDoc system. This REST API Reference describes available methods for the DocForm objects.

API overview

Method

API endpoint

Get document dataGET api/v1/docForm/{id}
Get document attachmentGET api/v1/docForm/file/{fileId}
Get documents in the viewGET api/v1/docForm/view/{viewId}
Process & update documentPUT api/v1/docForm/{id}/docResponse/{respId}
Move document to the new phasePOST api/v1/docForm/{id}/docResponse
Create new documentPOST api/v1/docForm/form/{formName}



Get document data

URL & Method & Description

GET api/v1/docForm/{id}

Retrieves document data.

Request:

Request (sample)
GET https://eldoc.domain.com/api/v1/docForm/{id}
ParamTypeDescriptionSample values (comma separated)
{id}Path paramShort id (webId) or full id (24 hex-character) of the DocFormF12, 59d4582e42a6273b107abcb0
{fields}Query param

Fields to be included in response. This parameter also supports the following computed properties:

  • valuesByTags
  • filesList
_id, _id_web, filesList
{embed}Query param

Additional entities to be included in response as embedded objects. Currently supported:

  • docResponse
  • recoResult
docResponse, recoResult

Response:

Response headers
Content-Type: application/json
Response body (sample)
{
    "_id": "5e0afc59819e6b69485aeed5",
    "_id_web": "A4",
    "_meta": {
        "_created": "2019-12-31T07:44:25Z",
        "_lastmodified": "2019-12-31T07:45:05Z",
        "_rev": 5
    },
    "author": "usr-bf7ad850-8708-493d-96a5-7c064f9b8528",
    "state": 100,
    "step": 0,
    "iteration": 1,
    "status": 1,
    "formsystype": 0,
	"recoResult": {
        "recoFormConf": 96.54,
        "recoForm": {
            "_id": "5e7c02c805a0ac7d686d7f45",
            "name": "Invoice_AR_form_v1"
        }
    }
    "...": "..."
}




Get document attachment

URL & Method & Description

GET api/v1/docForm/file/{fileId}

Retrieves document attachment file.

Request:

Request (sample)
GET https://eldoc.domain.com/api/v1/docForm/file/{fileId}
ParamTypeDescriptionSample values (comma separated)
{fileId}Path param

Full id (24 hex-character) of the file. Retrieved using query with param: fields=filesList

5e60c3e47b827239691c6dea

Response:

Response headers
Content-Type: application/octet-stream
Content-Disposition: attachment; filename*=UTF-8''attachment_file_name.ext
Content-Length: 0
Response body (sample)
// Binary file content




Get documents in the view

URL & Method & Description

GET api/v1/docForm/view/{viewId}

Retrieves documents available for the user in the specified view (documents folder / documents category).

Request:

Request (sample)
GET https://eldoc.domain.com/api/v1/docForm/view/{viewId}
ParamTypeDescriptionSample values (comma separated)
{viewId}Path param

Name of the view. Currently supported views:

  • inbox
  • repository
  • archive

inbox, repository, archive

{first}Query paramFirst document index to be retrieved. First request usually starts from index 0. Default value is 0.0, 15, 50
{pageSize}
Query paramNumber of documents to be retrieved per request. Default value is 10. Maximum value is 99.1, 5, 10, 20
{fields}Query param

Fields to be included in response. This parameter also supports the following computed properties:

  • valuesByTags
  • filesList
_id, _id_web, filesList
{embed}Query param

Additional entities to be included in response as embedded objects. Currently supported:

  • docResponse
  • recoResult
docResponse, recoResult

Response:

Response headers
Content-Type: application/json
X-Total-Count: 0
Response body (sample)
[
    {
        "_id": "59b803ba60e9ab2c6e7b7564",
        "_id_web": "C0A",
        "filesList": [
            {
                "id": "59b803ba60e9ab2c6e7b7560",
                "fileName": "DMS Solutions Overview 1.pptx"
            }
        ]
    },
    {
        "_id": "59b803ba60e9ab2c6e7b7569",
        "_id_web": "C1A",
        "filesList": [
            {
                "id": "59b803ba60e9ab2c6e7b7565",
                "fileName": "DMS Solutions Overview 2.pptx"
            }
        ]
    }
]




Process & update document

URL & Method & Description

PUT api/v1/docForm/{id}/docResponse/{respId}

Processes the document by adding DocResponse to the document with specific status.

Request:

Request (sample)
PUT https://eldoc.domain.com/api/v1/docForm/{id}/docResponse/{respId}
Request headers
Content-Type: application/json
ParamTypeDescriptionSample values (comma separated)
{id}Path param

Short id (webId) or full id (24 hex-character) of the DocForm

F12, 59d4582e42a6273b107abcb0
{respId}Path paramFull id (24 hex-character) of the DocResponse_id, _id_web, filesList
Request body (sample)
{
    "docForm" : {
		"valuesByTags": {
		    "{TAG}": "{VALUE}"
		}
    },
    "docResponse" : {
		"taskstatus" : {taskStatus}
    }
}


Request body keys:DescriptionSample values (comma separated)

docForm

{
  "valuesByTags": {
    "{TAG}": "{VALUE}"
  },
  "_tags": ["tag1", "tag2"]
}

valuesByTags - Provide values to be assigned to the document fields based on TAGs

_tags - system field for storing document tags

{
  "valuesByTags": {
    "TAG1": "Value 1",
    "TAG2_DATE": "2020-03-05T08:06:09Z"
  },
  "_tags": ["ReportingQ3"]
}
docResponse
{
  "taskstatus": {taskStatus}
}

taskStatus - Action to be performed on the newly created document (DocResponse task status).

Available task statuses:

5 - Response action: Execution Done

4 - Response action: Decline

{
  "taskstatus": 5
}

Response:

Response CodesDescription
200 - OKDocument was successfully updated & processed
422 - UNPORCESSABLE ENTITYRequest was successfully executed but no data was updated


Move document to the new phase

URL & Method & Description

POST api/v1/docForm/{id}/docResponse

Moves document to the new process phase.

Access rights requirement

Method requires [elAdminDocsRW] role

Request:

Request (sample)
POST https://eldoc.domain.com/api/v1/docForm/{id}/docResponse
Request headers
Content-Type: application/json
ParamTypeDescriptionSample values (comma separated)
{id}Path param

Short id (webId) or full id (24 hex-character) of the DocForm

F12, 59d4582e42a6273b107abcb0
Request body (sample)
{
    "docResponse" : {
		"taskstatus" : {taskStatus}
    }
}


Request body keys:DescriptionSample values (comma separated)
docResponse
{
  "taskstatus": {taskStatus}
}

taskStatus - Action to be performed on the document (DocResponse task status).

Available task statuses:

107 - Response action: To Archive

{
  "taskstatus": 107
}

Response:

Response CodesDescription
200 - OKDocument was successfully updated & processed
422 - UNPORCESSABLE ENTITYRequest was successfully executed but no data was updated


Create new document

URL & Method & Description

POST api/v1/docForm/form/{formName}

Creates new document in the system.

Request:

Request (sample)
POST https://eldoc.domain.com/api/v1/docForm/form/{formName}
Request headers
Content-Type: multipart/form-data


ParamTypeDescriptionSample values (comma separated)
{formName}Path param

Short id of the document form to be used for creating a new document in the system

frd1, fd1, fd5
{fields}Query paramFields to be included in response_id, _id_web, filesList
{allowDupl}Query paramFlag defines whether check for file duplication to be done (based on SHA-256 file attachments hash-sum)true|false (default: true - duplicates are allowed in the system)

{idpLngs}

Query paramIDP: parameter for selecting languages for indexing file content with OCR

eng, eng+chi_tra, eng%2Bchi_tra (default: eng)

{idpFrpr}Query paramIDP: flag for forcing elDoc to pre-process file-attachment (not recommended to enable for PDF-text based files, as text content will be replaced by performing OCR)true|false (default: false)
Form-data body parts:DescriptionSample values (comma separated)

docForm

{
  "valuesByTags": {
    "{TAG}": "{VALUE}"
  },
  "author": "{systemId}",
  "_tags": ["tag1", "tag2"]
}

valuesByTags - Provide values to be assigned to the document fields based on TAGs

author - SystemId value of the document author on behalf of whom the document is to be created. May contain email address of the user

_tags - system field for storing document tags

{
  "valuesByTags": {
    "DOC_TOPIC": "Doc topic content",
    "DATE_CREATED": "2020-03-05T08:06:09Z"
  },
  "author": "usr-bf7ad850-8708-493d-96a5-7c064f9b8528",
  "_tags": ["Report-2021"]
}
docResponse
{
  "taskstatus": {taskStatus}
}

taskStatus - Action to be performed on the newly created document (DocResponse task status).

Available task statuses:

106 - Send document to Execution phase

{
  "taskstatus": 106
}
filesFiles to be attached to the created document

Response:

Response CodesDescription
201 - CreatedDocument was successfully created
Response headers
Content-Type: application/json


Response body (sample)
{
    "_id": "5e60c0fed1de2b6966aebcee",
    "_id_web": "1570",
    "_meta": {
        "_created": "2020-03-05T09:06:06Z",
        "_lastmodified": "2020-03-05T09:06:11Z",
        "_rev": 5
    },
    "author": "usr-bf7ad850-8708-493d-96a5-7c064f9b8528",
    "state": 3,
    "step": 1,
    "iteration": 1,
    "status": 1,
    "formsystype": 0,
    "datecreated": "2020-03-05T08:06:09Z",
    "datedue": "",
    "...": "..."
}

Last modified: April 28, 2023