...
Page Properties | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||
Resources & Remarks Modification History
|
Excerpt |
---|
Access the binary content file via webhook files via webhooks during the import process. |
...
If an object is imported to yuuvis® Momentum, a binary content file can be assigned in addition to the object's metadata. The storage of the binary content file is managed by the REPOSITORY service. Afterwards, the metadata are stored in a separate database and are indexed for search.
>> Basic Use Case Flows
As soon as the object import process is finished, the binary content file can be accessed as well. Especially, it can be analysed in order to set some content-related metadata properties for the corresponding object. The metadata update is possible, i.e., via POST or PATCH /api/dms/objects/{objectId} and triggers the creation of a new object version. However, in some use cases, it might be necessary to set metadata properties depending on an analysis of the corresponding binary content file already for the first version of the imported object. For this purpose, the binary content file can be accessed from a webhook that is called after storing the content and before storing the metadata. This tutorial describes an example solution using an internal endpoint of the REPOSITORY service.
...
The webhook entry point has to be located after storing the binary content file and before storing the metadata in the process chain of an object import. For this purpose, the type dms.request.objects.upsert.database-before is suitable.
The tutorial Preprocessing Metadata using Webhooks provides tutorial provides a general example on how to configure and set up your own webhook service. A more specific example controller class for a webhook service for our concrete use case is provided in the code block below. For each object imported with a binary content file, the MD5 digest of the corresponding content is calculated. Since an internal endpoint of the REPOSITORY service has to be called, the webhook service must run within the yuuvis® Momentum Kubernetes cluster.
As defined on in lines 2 and 5, the webhook service will be available via the URL /api/process/checkcontent
. This endpoint accepts the import request body containing all objectof the objects' s metadata, and the request headers (line 6).
Especially in the case of a batch import, it is necessary to iterate over the individual objects (line 13) as the repository can only retrieve the content of one object at a time. For each individual object, the existence of an assigned binary content file is checked (line lines 17 , and 19). The binary content file is retrieved from the repository (starting on in line 28) and its MD5 digest is calculated (line 47). The value is printed to the console (line 55).
...