I want use retrofit2 with Spring. But I don't know how to convert that.
curl command below
curl --location --request POST 'api-url' \
--header 'x-chain-id: PORT' \
--header 'Authorization: API-KEY' \
--form 'file=@"/img-path"'
and I will make image file from image url and make MultipartBody.part like below
URL url = new URL("url");
BufferedImage image = ImageIO.read(url);
tempFile = new File("path");
ImageIO.write(image, "png", tempFile);
MultipartBody.Part filePart = MultipartBody.Part.createFormData("file", tempFile.getName(), RequestBody.create(MediaType.parse("image/*"), tempFile));
RequestBody fbody = RequestBody.create(MediaType.parse("image/*"),
tempFile);
and call interface method
@Multipart
@POST("v1/metadata/asset")
Call<Asset> getAsset(@Header("Authorization") String authentication, @Header("x-chain-id") String chainId,
@Part("file\"; filename=\"pp.png\" ") RequestBody file);
Where is wrong?