改造 URL 参数上没有键名 [英] Retrofit no key name on URL parameter

查看:30
本文介绍了改造 URL 参数上没有键名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to call an Api on retrofit just like that sample:

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

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

I dont need the key parameter specification, just the value straight implicit (ie: &somekey=value&someotherkey=value)

我会在 @Path 上进行连接,但我对优雅有一些疑问.

I'd concatenate on a @Path, but I have some doubts about the elegance.

推荐答案

试试这个方法.

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

You can pass entire query to your rest api method like this:

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

在 REST api 方法中像这样使用它:

In REST api method use it like this:

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

希望能帮到你!

这篇关于改造 URL 参数上没有键名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆