I'm using Retrofit2
I need to ask api with simply get looking like that http://1.1.1.1/get?key=value1&value2
How can I have query with only value? As value2 in above example? I've tried like here: Retrofit no key name on URL parameter
Any ideas?
In this kind of case you can directly call entire URL.
@GET()
Call<ResponseVO> test(@Url() String url);
And call
test("http://1.1.1.1/get?key=value1&value2")
With the latest version of Retrofit2 @QueryName
@GET("http://1.1.1.1/get")
Call<Object> getYourData(@Query("key") String key, @QueryName String value);
When you call the method, each query name is appended to the URL. You can see the JavaDoc here: https://square.github.io/retrofit/2.x/retrofit/retrofit2/http/QueryName.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With