api/v2/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 data | GET api/v2/docForm/{id} | 
| Get document attachment | GET api/v2/docForm/file/{fileId} | 
| Get documents in the view | GET api/v2/docForm/view/{viewId} | 
| Process & update document | PUT api/v2/docForm/{id}/docResponse/{respId} | 
| Move document to the new phase | POST api/v2/docForm/{id}/docResponse | 
| Create new document | POST api/v2/docForm/form/{formName} | 
Common request parameters overview
| Param | Type | Description | Sample values (comma separated) | 
|---|---|---|---|
{id} | Path param | Short id (webId stored in the _id_web property) or full id (24 hex-character value stored in the _id property) of the DocForm | F12, 59d4582e42a6273b107abcb0 | 
{fields} | Query param | Filters fields which are to be included in the response. Fields listed in this parameter also affect fields of the embedded entities, requested using "embed" parameter  | _id, _id_web, state | 
{embed} | Query param | Additional entities to be included in response as embedded objects. Currently supported: 
  | docResponse, recoData, recoResult | 
Get document data
GET api/v2/docForm/{id}
Retrieves document data.
Request:
GET https://eldoc.domain.com/api/v2/docForm/{id}?fields=_id,_id_web,state,status,step,recoForm,pageIdxStart,pageIdxEnd,validated&embed=recoData,recoResult,valuesByTags,filesList
Response:
Content-Type: application/json
{
    "_id": "5f3cd74236332879f7b3e723",
    "_id_web": "2950",
    "state": 3,
    "step": 3,
    "status": 1,
    "valuesByTags": {
        "DOC_TOPIC": "Application documents submission",
        "DATE_CREATED": "2020-08-19T07:39:46Z"
    },
    "filesList": [
        {
            "id": "5f3cd74236332879f7b3e729",
            "fileName": "application_multi_doc.pdf"
        }
    ],
    "recoData": [
        {
            "_id": "5f3cd7b436332879f7b3e7d1",
            "pageIdxEnd": 0,
            "pageIdxStart": 0,
            "validated": false,
            "recoForm": {
                "form": null,
                "id": "5f3caa5680dd6b2c3b7898c2",
                "name": "Transcript_v1"
            },
            "valuesByTags": {
                "DOC_TYPE": "Advanced",
                "GRADES": [
                    ["Subject eng", "Subject grade"],
                    ["GEOGRAPHY ", "E(e)"]
                ],
                "YEAR": "2012"
            },
            "recoResult": {
                "recoForm": {
                    "form": null,
                    "id": "5f3caa5680dd6b2c3b7898c2",
                    "name": "Transcript_v1"
                },
                "recoFormConfidence": 100.0
            }
        },
        {...}
    ]
}
Response body description:
| Property | Data Type | Description | 
|---|---|---|
| valuesByTags | Object | Document level fields arranged by their tags. During the manual validation step these values can be altered by user. | 
| filesList | Array | Document level file-attachments | 
recoData  | Array | For the Recognition Documents "recoData" field contains recognition related data. In case several RecoForms were identified in the file-attachment during IDP - all those results will be stored as entries of the "recoData" field See RecoData data model description.  | 
Get document attachment
GET api/v2/docForm/file/{fileId}
Retrieves document attachment file.
Request:
GET https://eldoc.domain.com/api/v2/docForm/file/{fileId}
| Param | Type | Description | Sample values (comma separated) | 
|---|---|---|---|
{fileId} | Path param | Full id (24 hex-character) of the file. Retrieved using query with param:   | 5e60c3e47b827239691c6dea  | 
Response:
Content-Type: application/octet-stream Content-Disposition: attachment; filename*=UTF-8''attachment_file_name.ext Content-Length: 0
// Binary file content
Get documents in the view
GET api/v2/docForm/view/{viewId}
Retrieves documents available for the user in the specified view (documents folder / documents category).
Request:
GET https://eldoc.domain.com/api/v2/docForm/view/{viewId}
| Param | Type | Description | Sample values (comma separated) | 
|---|---|---|---|
{viewId} | Path param | Name of the view. Currently supported views: 
  | inbox, repository, archive  | 
{first} | Query param | First document index to be retrieved. First request usually starts from index 0. Default value is 0. | 0, 15, 50 | 
{pageSize} | Query param | Number of documents to be retrieved per request. Default value is 10. Maximum value is 99. | 1, 5, 10, 20 | 
Response:
Content-Type: application/json X-Total-Count: 0
[
    {
        "_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
PUT api/v2/docForm/{id}/docResponse/{respId}
Processes the document by adding DocResponse to the document with specific status.
DocResponse generation
In order to retrieve respective {respId} execute GET request for retrieving DocForm with &embed=docResponse param. System will generate DocResponse for the current Service Account according to the document's workflow configuration for the current document phase.
Request:
PUT https://eldoc.domain.com/api/v2/docForm/{id}/docResponse/{respId}
Content-Type: application/json
| Param | Type | Description | Sample values (comma separated) | 
|---|---|---|---|
{respId} | Path param | Full id (24 hex-character) of the DocResponse | 59d4582e42a6273b107abcb0 | 
{
    "docForm" : {
		"valuesByTags": {
		    "{TAG}": "{VALUE}"
		}
    },
    "docResponse" : {
		"taskstatus" : {taskStatus},
        "content" : "{content}"
    }
}
| Request body keys: | Description | Sample values (comma separated) | 
|---|---|---|
  | {
  "valuesByTags": {
    "{TAG}": "{VALUE}"
  }
}
  | {
  "valuesByTags": {
    "TAG1": "Value 1",
    "TAG2_DATE": "2020-03-05T08:06:09Z"
  }
}
 | 
docResponse | {
  "taskstatus": {taskStatus},
  "content" : "{content}"
}
 Available task statuses (Response actions): 4 - Decline 5 - Execution Done 
  | {
  "taskstatus": 5,
  "content": "Document posted successfully"
}
 | 
Response:
| Response Codes | Description | 
|---|---|
200 - OK | Document was successfully updated & processed | 
422 - UNPORCESSABLE ENTITY | Request was successfully executed but no data was updated | 
Move document to the new phase
POST api/v2/docForm/{id}/docResponse
Moves document to the new process phase.
Access rights requirement
Method requires [elAdminDocsRW] role for Service Account when document author is not a Service Account which originated the request
Request:
POST https://eldoc.domain.com/api/v2/docForm/{id}/docResponse
Content-Type: application/json
{
    "docResponse" : {
		"taskstatus" : {taskStatus}
    }
}
| Request body keys: | Description | Sample values (comma separated) | 
|---|---|---|
docResponse | {
  "taskstatus": {taskStatus}
}
 Available task statuses: 107 - Response action: To Archive  | {
  "taskstatus": 107
}
 | 
Response:
| Response Codes | Description | 
|---|---|
200 - OK | Document was successfully updated & processed | 
422 - UNPORCESSABLE ENTITY | Request was successfully executed but no data was updated | 
Create new document
POST api/v2/docForm/form/{formName}
Creates new document in the system.
Request:
POST https://eldoc.domain.com/api/v2/docForm/form/{formName}
Content-Type: multipart/form-data
| Param | Type | Description | Sample 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 | 
{allowDupl} | Query param | Flag 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) | 
  | Query param | IDP: parameter for selecting languages for indexing file content with OCR | eng, eng+chi_tra, eng%2Bchi_tra (default: eng)  | 
{idpFrpr} | Query param | IDP: 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: | Description | Sample values (comma separated) | 
|---|---|---|
  | {
  "valuesByTags": {
    "{TAG}": "{VALUE}"
  },
  "author": "{systemId}"
}
 
  | {
  "valuesByTags": {
    "DOC_TOPIC": "Doc topic content",
    "DATE_CREATED": "2020-03-05T08:06:09Z"
  },
  "author": "usr-bf7ad850-8708-493d-96a5-7c064f9b8528"
}
 | 
docResponse | {
  "taskstatus": {taskStatus}
}
 Available task statuses: 106 - Send document to Execution phase  | {
  "taskstatus": 106
}
 | 
files | Files to be attached to the created document | 
Response:
| Response Codes | Description | 
|---|---|
201 - Created | Document was successfully created | 
Content-Type: application/json
{
    "_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