-1

I am uploading image/file using retrofit

here I am posting My API call to upload image

baseurl/index.php?request={"img_req":{"key":"gflkgjdfkgjdkl","c":"property","a":"pr_image_upload","job_id":"cc65643bfa7f27ca1530281112278_images","parameters":{"property_id":abcded,"auth_key":"kgdfklgjdklfgjk"}}}

Please help me how to write interface for this call, I have tried with @part and @PartMap but does not work

Munir
  • 219
  • 3
  • 11

1 Answers1

2

I have found solution of above mentioned problem

Create a JSON string which contains query string parameters, and then pass Query string to API interface

@Multipart
@POST("index.php")
Call<ResponseBody> uploadImage(@Query("request") String request, @Part MultipartBody.Part fileBody);

More suggestions are welcomed

Munir
  • 219
  • 3
  • 11