In the Google documentation about it is not written, I use retrofit 2. Help. Write what request should be sent and what parameters to transmit
interface:
@PATCH("drive/v3/files/{fileId}")
@Multipart
Call<ResponseBody> renameFileGoogle(
@Path("fileId")String fileId,
@Part MultipartBody.Part metaPart
);
call metod:
public void renameMetod(String id, String title) {
String content = "{\"name\": \"" + title + "\"}";
MediaType contentType = MediaType.parse("application/json; charset=UTF-8");
MultipartBody.Part metaPart = MultipartBody.Part.create(RequestBody.create(contentType, content));
Call<ResponseBody> renameRequest = server.renameFileGoogle(id, metaPart);
renameRequest.enqueue(new Callback<ResponseBody>()...
It's there in the documentation https://developers.google.com/drive/v2/reference/files/patch
You need to send an HTTP PATCH request
PATCH https://www.googleapis.com/drive/v2/files/{fileId}
RequestBody:
{"title":"newTitle"}
For version 3 https://developers.google.com/drive/v3/reference/files/update
PATCH https://www.googleapis.com/drive/v3/files/{fileId}
RequestBody:
{"name":"newTitle"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With