mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-23 02:48:26 +00:00
Update docs and screenshots
This commit is contained in:
@ -92,95 +92,7 @@ docspell count the files uploaded through the web interface, just
|
||||
create a source (can be inactive) with that name (`webapp`).
|
||||
|
||||
|
||||
# Integration Endpoint
|
||||
# Other options
|
||||
|
||||
Another option for uploading files is the special *integration
|
||||
endpoint*. This endpoint allows an admin to upload files to any
|
||||
collective, that is known by name.
|
||||
|
||||
```
|
||||
/api/v1/open/integration/item/[collective-name]
|
||||
```
|
||||
|
||||
The endpoint is behind `/api/v1/open`, so this route is not protected
|
||||
by an authentication token (see [REST Api](@/docs/api/_index.md) for
|
||||
more information). However, it can be protected via settings in the
|
||||
configuration file. The idea is that this endpoint is controlled by an
|
||||
administrator and not the user of the application. The admin can
|
||||
enable this endpoint and choose between some methods to protect it.
|
||||
Then the administrator can upload files to any collective. This might
|
||||
be useful to connect other trusted applications to docspell (that run
|
||||
on the same host or network).
|
||||
|
||||
The endpoint is disabled by default, an admin must change the
|
||||
`docspell.server.integration-endpoint.enabled` flag to `true` in the
|
||||
[configuration file](@/docs/configure/_index.md#rest-server).
|
||||
|
||||
If queried by a `GET` request, it returns whether it is enabled and
|
||||
the collective exists.
|
||||
|
||||
It is also possible to check for existing files using their sha256
|
||||
checksum with:
|
||||
|
||||
```
|
||||
/api/v1/open/integration/checkfile/[collective-name]/[sha256-checksum]
|
||||
```
|
||||
|
||||
See the [SMTP gateway](@/docs/tools/smtpgateway.md) or the [consumedir
|
||||
script](@/docs/tools/consumedir.md) for examples to use this endpoint.
|
||||
|
||||
# The Request
|
||||
|
||||
This gives more details about the request for uploads. It is a http
|
||||
`multipart/form-data` request, with two possible fields:
|
||||
|
||||
- meta
|
||||
- file
|
||||
|
||||
The `file` field can appear multiple times and is required at least
|
||||
once. It is the part containing the file to upload.
|
||||
|
||||
The `meta` part is completely optional and can define additional meta
|
||||
data, that docspell uses to create items from the given files. It
|
||||
allows to transfer structured information together with the
|
||||
unstructured binary files.
|
||||
|
||||
The `meta` content must be `application/json` containing this
|
||||
structure:
|
||||
|
||||
``` elm
|
||||
{ multiple: Bool
|
||||
, direction: Maybe String
|
||||
, folder: Maybe String
|
||||
, skipDuplicates: Bool
|
||||
}
|
||||
```
|
||||
|
||||
The `multiple` property is by default `true`. It means that each file
|
||||
in the upload request corresponds to a single item. An upload with 5
|
||||
files will result in 5 items created. If it is `false`, then docspell
|
||||
will create just one item, that will then contain all files.
|
||||
|
||||
Furthermore, the direction of the document (one of `incoming` or
|
||||
`outgoing`) can be given. It is optional, it can be left out or
|
||||
`null`.
|
||||
|
||||
A `folder` id can be specified. Each item created by this request will
|
||||
be placed into this folder. Errors are logged (for example, the folder
|
||||
may have been deleted before the task is executed) and the item is
|
||||
then not put into any folder.
|
||||
|
||||
The `skipDuplicates` is optional and set to `false` if not specified.
|
||||
It configures the processing task. If set to `true`, the processing
|
||||
task will skip all input files that are already present in docspell.
|
||||
|
||||
This kind of request is very common and most programming languages
|
||||
have support for this. For example, here is another curl command
|
||||
uploading two files with meta data:
|
||||
|
||||
``` bash
|
||||
curl -XPOST -F meta='{"multiple":false, "direction": "outgoing"}' \
|
||||
-F file=@letter-en-source.pdf \
|
||||
-F file=@letter-de-source.pdf \
|
||||
http://192.168.1.95:7880/api/v1/open/upload/item/3H7hvJcDJuk-NrAW4zxsdfj-K6TMPyb6BGP-xKptVxUdqWa
|
||||
```
|
||||
More details about the actual http request and other upload options
|
||||
can be found [here](@/docs/api/upload.md).
|
||||
|
Reference in New Issue
Block a user