I am trying to upload an image on \"https://api.cloudsightapi.com/image_requests\" but after request call i am getting all the fields null into response .i.e status,nam
CloudSight stopped accepting MultipartBody.Part So we have to send RequestBody i.e file with image name.
I have solved the issue with following steps:
RequestBody requestFile = RequestBody.create(MediaType.parse("image*/"), file);
String descriptionString = "en-US";
RequestBody description = RequestBody.create(MediaType.parse("multipart/form-data"), descriptionString);
apiInterface.uploadPhoto("CloudSight key",description, requestFile);
In retrofit api call:
@Multipart
@POST("https://api.cloudsightapi.com/image_requests")
Call uploadPhoto(
@Header("Authorization") String authorisation,
@Part("image_request[locale]") RequestBody description,
@Part("image_request[image]\"; filename=\"file.jpg\" " ) RequestBody file);
Hope This helps. Thanks.