在 URL 参数上改造无键名

Retrofit no key name on URL parameter

我需要像那个示例一样调用 Api 进行改造:

http://api.paco.com/c?version_int&somekey&someotherkey&lastkey&用户+输入&some_base64

我不需要关键参数说明,只需要直接隐含的值(即:&somekey=value&someotherkey=value)

我会在 @Path 上进行串联,但我对它的优雅性有些怀疑。

试试这个方法。

您可以像这样将整个查询传递给其余 api 方法:

callMethod("?version_int&somekey&someotherkey&lastkey&user+input&some_base64")

在 REST api 方法中这样使用:

@GET("/c{query}")
void callMethod(@EncodedPath("query") String query);

希望对您有所帮助!