改造如何在 url 中使用冒号?

yoo*_*hok 3 android rx-java retrofit google-photos

我正在使用 Google Photo API 开发 Android 应用程序。

我正在尝试使用以下 API 将图像文件上传到 Google Photo Server。

https://developers.google.com/photos/library/reference/rest/v1/mediaItems/batchCreate

根据文档,我应该使用以下 URL 上传图像文件。

POST https://photoslibrary.googleapis.com/v1/mediaItems:batchCreate
Run Code Online (Sandbox Code Playgroud)

所以我使用改造来编写代码。

@Headers("Content-type: application/json")
@POST("mediaItems:batchCreate") // The point is here
fun batchCreate(@Header("Authorization") authorization: String, @Body batchCreateRequest: BatchCreateRequest): Observable<BatchCreateResponse>
Run Code Online (Sandbox Code Playgroud)

当我运行它时,发生了 IllegalArgumentException。

java.lang.IllegalArgumentException:URL 格式错误。基础:https ://photoslibrary.googleapis.com/v1/,相对:mediaItems:batchCreate

我能做些什么来解决这个问题?

Vis*_*ora 6

尝试使用@POST("./mediaItems:batchCreate")代替@POST("mediaItems:batchCreate")