Document

This chapter includes how to upload documents to Enadoc and how to retrieve documents from Enadoc via Enadoc API.

Upload Document to My Workspace

GET [ENADOC_URL] /api/v3/myworkspace/documents/{name}

My Workspace is a temporary storage for the documents. You can keep document in my workspace until you upload document to Enadoc library. Follow below steps to upload documents to my workspace via Enadoc API.

Path Parameters

Name
Type
Description

name

string

Uploading file name, without file extension

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Content-type

string

File mime type

Request Body

Name
Type
Description

Content

array

Byte array context

Upload Document to Enadoc Library

Pre-requisites from Enadoc:

You must follow the below-mentioned steps from Enadoc before you upload the document to Enadoc via API.

  • Create library

First, create library/s to store various types of documents separately.

  • Create indexes for the library

You must create specific indexes under each library to insert document metadata while uploading documents.

  • Create document permission

Document accessibility is managed by document permission.

  • Create tag profiles

Tag Profiles are required to upload documents to the library. While uploading documents, you must select a tag profile. You can create multiple tag profiles for one library with different security levels and different permission scopes. The document permission and security level are identified by the system through the tag profile you have selected while uploading. Therefore, you must create tag profiles before starting the upload document process to the new library.

  • Configure tag profile accessibility and other library level user permission

Since you keep user groups globally, you are required to manage their library level permission. You must assign accessible tag profiles for each user group otherwise that user group has no permission to upload documents via tag profile.

  • You can define library level user rights for each user individually. If you expect to manage index accessibility for each user, configure it before uploading documents.

Enadoc API document upload methods

There are three different API methods you can use for document uploading. You can use any of the following methods as per the purpose.

  • Upload document - simple

  • Upload document - Resumable

  • Upload document - Index-only

Upload Document - Simple

POST [ENADOC_URL] /api/v3/documents/?type=simple

You can upload full document using this method.

Path Parameters

Name
Type
Description

type*

string

Use the document type as ‘simple’ at the end of URL. Because this upload method called simple.

Headers

Name
Type
Description

Authorization*

string

Type - Bearer Access token will be sent in request headers

Content-type*

string

multipart/form-data; boundary={{boundary}}

Request Body

Name
Type
Description

document-indexes*

string

Request body should contain multi part content. The indexes and the file. Follow the format given in the code block below. ⤵️

file*

String

Request body should contain multi part content. The indexes and the file. Follow the format given in the code block below. ⤵️

Follow the format given in the following example to send multipart content as the body parameter of the request.

Request Header

Request Body

Upload Document (Resumable)

You can upload documents as multiple parts using this method. This is applicable for large file sending. First, send the document indexes/data and receive the upload token. Next send your document parts by parts using an upload token.

When you upload the document as resumable, you must execute two methods. You can include document data to the first method and then attach documents to the second method.

Execute the first method to send document data

Upload Document (Resumable) - Part I

POST [ENADOC_URL] /api/v3/documents/?type=resumable

First send the document indexes/data and receive upload token using this method. Next send your document parts by parts using second method.

Path Parameters

Name
Type
Description

Type

string

Use the document type as ‘resumable’ at the end of document url. Because this upload method called Resumable.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Content-type

string

multipart/related

Request Body

Name
Type
Description

Document details

object

Request body should contain the document name, tag profile, index values and file meta data. Follow the format given in the code block below.

Follow the format given in the code block to send the document details as the body parameter of the API request.

The Request body should contain the document name, tag profile, index values and file metadata. File metadata consists of the block length (Block size), file length (file size), content type (pdf/jpeg), hash signature (a security tag). Refer to the json example included in the body table.

Note: Obtain your document hash signature using the SHA256 algorithm before uploading your document.

Execute next method to send the document to Enadoc

Upload Document (Resumable) - Part II

PUT [ENADOC_URL] /api/v3/documents/documenttoken/chunk sequence

Now send your document part by part using upload token.

Path Parameters

Name
Type
Description

document token

string

Document token

chunk sequence

integer

Chunk Id

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Content-type

string

application/octet-stream

Request Body

Name
Type
Description

Content

array

File chunk - byte array content

Upload Document (Index-only)

POST [ENADOC_URL] api/v3/documents/?type=index

Use this upload method to send only document indexes without document.

Path Parameters

Name
Type
Description

type

string

Document uploading type - index-only

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

string

Application/json

Request Body

Name
Type
Description

Content

array

Request body should contain the index meta data. Follow the format given in the code block below.

Follow the format given in the code block to send as the index metadata body parameter of the API request.

Get Document (Byte Array)

GET [ENADOC_URL] /api/v3/documents/{document-token}

Use this method to get document byte array.

Path Parameters

Name
Type
Description

document-token

string

Document reference token ‘Document token’ is the one you have obtained after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token should be sent in request headers

Put Document Comments

PUT [ENADOC_URL] /api/v3/documents/{documentToken}/comments

Pre-requisites from Enadoc: You must have already uploaded document.

Path Parameters

Name
Type
Description

Document-token

string

Document reference token

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Request Body

Name
Type
Description

Comment

string

Content Type - Application/Json Request body should contain the comment. Follow the format given in the code block below. "Document is okay"'

Follow the format given in the code block to send document comments as the body parameter of the API request.

Get document comments

GET [ENADOC_URL] /api/v3/documents/{documentToken}/comments

Pre-requisites from Enadoc - You must have already put document comments.

Path Parameters

Name
Type
Description

Document-token

string

Document reference token Use ‘Document token’ which you have received after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request header

Put document flags

PUT [ENADOC_URL] /api/v3/documents/{documentToken}/flags

Pre-requisites from Enadoc: You must have already uploaded document.

Path Parameters

Name
Type
Description

documentToken

string

Document reference token

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request header

Request Body

Name
Type
Description

Document Flag

string

Content type - Application/Json Request body should contain the flag. Follow the format given in the code block below

Follow the format given in the code block to send the flag as the body parameter of the API request

Get Document Flags

GET [ENADOC_URL] /api/v3/documents/{documentToken}/flags

Pre-requisites from Enadoc: You must have already put document flags.

Path Parameters

Name
Type
Description

documentToken

string

Attach document token at the end of url. Use ‘Document token’ which you have received after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Required Access token will be sent in request headers

Get Document User Tags

GET [ENADOC_URL] /api/v3/documents/{documentToken}/usertags

Pre-requisites from Enadoc: You must have already put document user tags.

Path Parameters

Name
Type
Description

Document-token

string

Attach document token at the end of url. Use ‘Document token’ which you have received after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Get Document URL

GET [ENADOC_URL] /api/v3/documents/{document-token}/url

Use this method to get document url

Path Parameters

Name
Type
Description

document-token

string

Attach document token as url parameter. ‘Document token’ is the one you have obtained after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Document Re-Indexing

PUT [ENADOC_URL] /api/v3/documents/{documentToken}/$reindex

Pre-requisites from Enadoc: You must have already uploaded document.

Path Parameters

Name
Type
Description

Document-token

string

Attach document token at the end of url. Use ‘Document token’ which you have received after upload document to Enadoc via API.

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request header

Request Body

Name
Type
Description

Re-index values

string

Content type - Application/Json Request body should contain re-index values.

Follow the format given in the code block to send re-index values as the body parameter of API request.

Get Document Meta Data

GET [ENADOC_URL] api/v3/documents/{document-token}/metadata

Use this method to get document meta data.

Path Parameters

Name
Type
Description

document-token

string

Document reference token

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

Get Document Code

GET GET/api/v3/documents?code={document code}

Use below url to get document token

Headers

Name
Type
Description

Authorization*

String

Verify Document

GET [ENADOC_URL] api/v3/documents/{document-hash}/verify

Use this method to verify document.

Path Parameters

Name
Type
Description

document-hash

string

Document hash (SHA256)

Headers

Name
Type
Description

Authorization

string

Type - Bearer Access token will be sent in request headers

POST [ENADOC_URL] api/v3/documents/$search?from=1&to=100

User can use this method to search document using keyword or date range. This method returns list of results along with index values according to the given search criteria.

Query Parameters

Name
Type
Description

From

integer

Start point of result set

to

integer

End point of result set

Request Body

Name
Type
Description

Search value filters

string

Request body contain search value filters as keyword, from date, To date and library/libraries id. Follow the format given in the code block below.

Body:

Request body consists of search value filters as a keyword, from date, To date and library/libraries id. Method parameters are as below.

keyWord: This is the keyword that users provide

fromDate: The date user provides to get the results. Results will be returned from the given date

toDate: The date user provides to get the results. Results will be returned till the given date.

libraries: Provide library/libraries ids that need to receive results.

Last updated

Was this helpful?