I have a Spring Boot REST API with a entity of type Incident, which has a list of Observation.
In this list of observations, I want to be able to add N attachments, but I don’t know how to relate them.
The API is a REST endpoint with headers=”Content-Type=multipart/form-data”, so all the data from the incident along with its observations arrives in the body as a stringObject, and separately, there is an array of Multipart[] files. How can I determine which multipart file belongs to which observation.
Add a list of filenames in the JSON object for each observation and then search for it in the list of attachments by its name, but if I have two attachments with the same name, I am not able to differentiate which one belongs to which observation.
I thought about converting it to base64, but my API is set up to receive attachments as Multipart files.Create unique uid or hash and send it in object…
Ioannis Odontidis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.