File Upload Using Feign – multipart/form-data

No, you don’t. You just need to define a kind of proxy interface method, specify the content-type as: multipart/form-data and other info such as parameters required by the remote API. Here is an example:

public interface FileUploadResource {

    @RequestLine("POST /upload")
    @Headers("Content-Type: multipart/form-data")
    Response uploadFile(@Param("name") String name, @Param("file") File file);

} 

The completed example can be found here: File Uploading with Open Feign

Leave a Comment