Skip to content

Instantly share code, notes, and snippets.

View ejreyme's full-sized avatar
🏠
Working from home

Emmanuel J. Reyme ejreyme

🏠
Working from home
View GitHub Profile
@stefan-huettemann
stefan-huettemann / RestTemplate-Multipart.java
Last active February 6, 2024 21:19
Multipart Request using spring RestTemplate
protected ResponseEntity<Resource<List<Attachment>>> patchMultipartApiV1_Treatments_TID(final String aTID,
final Treatment aTreatment,
final boolean keepLock,
final MultipartFile... aMultipartFiles) throws IOException {
final MultiValueMap<String, Object> theMultipartRequest = new LinkedMultiValueMap<>();
// creating an HttpEntity for the JSON part:
final HttpHeaders theJsonHeader = new HttpHeaders();
theJsonHeader.setContentType(MediaType.APPLICATION_JSON);