在URL参数上不加密钥名 [英] Retrofit no key name on URL parameter

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

问题描述

我需要像该样例那样调用Api进行翻新:

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

http://api.paco.com/c ? version_int & somekey & someotherkey & lastkey & user + input & some_base64

http://api.paco.com/c?version_int&somekey&someotherkey&lastkey&user+input&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天全站免登陆