Here is the interface for Retrofit2:
public interface OAuthServerIntf { .... @POST("upload/drive/v3/files?uploadType=multipart") @Multipart Call<JsonObject> uploadFileMutil( @Header("Authorization") String authToken, @Part MultipartBody.Part metaPart, @Part MultipartBody.Part dataPart); } Here is where I call:
public void onActivityResult(...) { .... MultipartBody.Part filePart = MultipartBody.Part.createFormData("image", file.getName(), fileBody); Call<JsonObject> request = server.uploadFileMutil(oauthToken.getAccessToken(),filePart); request.enqueue(new Callback<JsonObject>(){...}); } oauthToken.getAccessToken () -to get a token
MultipartBody.Part filePart - the file that I want to send to the server
In general, how to conduct a request and what are these 2 parameters metaPart and dataPart ?
I read that the token needs to be cast to the Bearer type, how to do it ???