REST API Reference
Contents:
The elDoc system offers a REST API that enables the creation of add-ons, development of integrations with other applications, and scripting interactions with elDoc. This page provides comprehensive documentation for the available REST resources, including details on expected HTTP response codes and sample requests.
Authentication & Authorization
elDoc REST API authentication is based on the JWT technology. Authentication token to be provided as Authorization
header with each request.
Authorization: Bearer XXXXX.YYYYY.ZZZZZ
For specific requirements on JWT claims, refer to the pages corresponding to the relevant API version, as security requirements may vary between versions. It is strongly recommended to use only the latest available API version and block access to deprecated versions.
Security principles
All access permissions are determined by the security rights assigned to the account making the request. This applies to all parts of the API, particularly for document-related operations. In addition to the roles and groups assigned to the user account, specific document-level access permissions are also enforced by the system.
URI Structure
elDoc's REST APIs provide access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. The elDoc REST API uses JSON as its communication format, and the standard HTTP methods like GET
, PUT
, POST
and DELETE
(see API descriptions below for which methods are available for each resource). URIs for elDoc's REST API resource have the following structure:
https://host:port/api/v2/api-name/resource-name/resource-path-param?param1=value1¶m2=value2
Where:
api
- static partv2
- stands for api version to be used, like v2api-name
- stands for the functionality name to be usedresource-name
- stands for resource or action to be calledresource-path-param
- stands for additional resource specific path paramsparam1=value1
- stands for additional resource specific params
Experimental methods
Methods marked as experimental may change without prior notice. Please refer to our release notes regularly and be prepared to make any necessary adjustments to these methods as updates are released.
Request headers
- eldoc-run-as - Request header available for some API-endpoints allows to impersonalize service account to run on behalf of the given person account
Response headers
- eldoc-error - Response header contains information about error, if any present
- eldoc-error-code - Response header contains internal error code, if any present
- eldoc-total-count - Response header contains number of total items found, e.g.: total number of records, documents, or pages in the document
File Name Handling (UTF-8 Support)
For API endpoints that support file uploads, file names can be submitted using the following Content-Disposition
fields:
filename="<fileName>" filename*=<fileNameEnc>
Where:
<fileName>
- is a basic US-ASCII encoded filename as per RFC-2183 (section 2.3);<fileNameEnc>
- is an encoded file name as specified in RFC-5987 (section 3.2.1). This standard describes encoded header field values and must follow the format:<ENCODING>'<LANGUAGE>'<value>
. Here,<value>
must be URL-encoded according to the URL encoding specification.
Examples of Valid Values:
For "bill-3.docx": filename*=UTF-8''bill-3.docx (Alternatively, use the standard field 'filename' as follows: filename="bill-3.docx") For "bill_5_複製.pdf": filename*=UTF-8''bill-5_%E8%A4%87%E8%A3%BD.pdf For "Інвойс.pdf": filename*=UTF-8''%D0%86%D0%BD%D0%B2%D0%BE%D0%B9%D1%81.pdf
Note: For the filename*
field, the value is not quoted.
If the filename*
field is present, elDoc will use its value as the file name for the uploaded via API file. If filename*
is absent, the generic filename
field value will be used instead.
Standard response codes
Code | Description |
---|---|
200 - OK | Everything worked as expected |
201 - Created | Request successfully processed, new entry was created |
204 - No Content | Request successfully processed, no entity is returned in response |
400 - Bad Request | The request was unacceptable, often due to missing a required parameter or validation error |
401 - Unauthorized | No valid API JWT token provided |
402 - Request Failed | The parameters were valid but the request failed |
403 - Forbidden | The API key doesn't have permissions to perform the request |
404 - Not Found | The requested resource doesn't exist |
409 - Conflict | The request conflicts with another request |
429 - Too Many Requests | Too many requests hit the API too quickly |
500, 502, 503, 504 - Server Errors | Something went wrong on elDoc's end (these are rare) |
Last modified: October 08, 2024