带有JSON参数的GET GET请求

问题描述 投票:0回答:1

我正在尝试通过对我的自定义对象进行改造来从解析服务器中获取。

http请求为:

https://MY.SERVER./1/classes/Fiestas?where={"Epoca":{"__type":"Pointer","className":"Epocas","objectId":"myObjectId"}}

所以我有这个界面:

@GET("Fiestas?where={\"Epoca\":{\"__type\":\"Pointer\",\"className\":\"Epocas\",\"objectId\":\"{epoca_id}\"}}")
fun getFiestaByEpocaId(@Path("epoca_id") epoca_id: String): Deferred<JSONResponse>

但是我遇到这个错误:

java.lang.IllegalArgumentException: URL query string "where={"Epoca":{"__type":"Pointer","className":"Epocas","objectId":"{epoca_id}"}}" must not have replace block. For dynamic query parameters use @Query.
    for method FiestaApi.getFiestaByEpocaId

有人知道在Kotlin中在GET改造请求中发送JSON的任何解决方案吗?

谢谢!

kotlin retrofit2
1个回答
0
投票

您可以尝试以下方法:

© www.soinside.com 2019 - 2024. All rights reserved.