Deleting files
The Documents Plugin provides functionality for deleting files.
Prerequisites
Before deleting files, ensure:
Access Permissions: Ensure that the user account used has the necessary access rights for updates or deletions.
Kafka Configuration:
- Verify Kafka Setup: Ensure proper configuration and accessibility of the Kafka messaging system.
- Kafka Topics: Understand the Kafka topics used for these operations.
- File IDs and Document Types: Prepare information for updating or deleting files:
fileId
: ID of the file to delete.customId
: Custom ID associated with the file.
info
In the example below, we use a fileId
generated for a document using Uploading a New Document scenario.
{
"docs": [
{
"customId": "119407",
"fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2",
"documentType": "BULK",
"documentLabel": null,
"minioPath": "flowx-dev-process-id-119408/119407/466_BULK.pdf",
"downloadPath": "internal/files/c4e6f0b0-b70a-4141-993b-d304f38ec8e2/download",
"noOfPages": 2,
"error": null
}
],
"error": null
}
Configuring the deletion process
To delete files, follow these steps:
- Create a process that includes a Message Event Send (Kafka) node and a Message Event Receive (Kafka) node:
- Use the Message Send node to send the delete request.
- Use the Message Receive node to receive the delete reply.
- Configure the first node (Message Send) by adding a Kafka send action.
- Specify the Kafka topic for sending the delete request.
tip
To identify defined topics in your environment:
- Navigate to Platform Status > FLOWX Components > document-plugin-mngt and click the eye icon on the right side.
- In the details screen, expand the
KafkaTopicsHealthCheckIndicator
line and then details → configuration → topic → file → delete. Here will find the in and out topics for deleting files.
- Fill in the request message body.
Message request example
Example of a message following the custom integration data model:
{
"customId": "119408",
"fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2"
}
- fileId: The ID of the file.
- customId: The custom ID.
- Configure the second node (Message Receive) by adding a Data stream topic:
info
The response will be sent to ..out
Kafka topic.
Receiving the reply
The reply body should contain the following values:
- customId: The unique identifier for your document (it could be for example the ID of a client)
- fileId: The ID of the file
- documentType: The document type
- error: Any error message in case of an error during the deleting process
Message response example
{
"customId": "119408",
"fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2",
"documentType": null,
"error": null
}