I am developing an Android app using Google Photo API.
I am trying to upload an image file into the Google Photo Server using below API.
https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate
According to the document, I should use below URL to upload an image file.
POST https://photoslibrary.googleapis.com/v1/mediaItems:batchCreate
So I write the code using the retrofit.
@Headers("Content-type: application/json")
@POST("mediaItems:batchCreate") // The point is here
fun batchCreate(@Header("Authorization") authorization: String, @Body batchCreateRequest: BatchCreateRequest): Observable<BatchCreateResponse>
When I run it, IllegalArgumentException occurred.
java.lang.IllegalArgumentException: Malformed URL. Base: https://photoslibrary.googleapis.com/v1/, Relative: mediaItems:batchCreate
What can I do solve this problem?
Try using @POST("./mediaItems:batchCreate")
instead of @POST("mediaItems:batchCreate")