Update event attachment, where to define file name

I have implemented an java microservice which updates the attachment of an event using the REST API: Cumulocity - OpenAPI

Technicaly it is working. I have an issue with the file name. For example, i am uploading a file named image.png. this is working without an issue but the filename different contains the event number, for example 6552800.txt. The content is correct when i rename it back to .png it will be shown. My question is:

How do i use the PUT on this REST endpoint so that i can also define the file name? With the POST (Cumulocity - OpenAPI) it is working by using multi-part/form-data and defining file as paramete. But here i can’t update existing attachments…

I made it. In the REST API documentation it is not clear defined. It is important to set the Content-Disposition header with setting additional header options it is working now!

headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDisposition(ContentDisposition.builder("attachment").filename(binaryInfo.getName()).build());
1 Like