I am trying to make an API call to a mobile backend with Retrofit 2.0. In my API call, i have to make necessary call to this URL
To form this URL in Retrofit i have been using below interface
@GET("Users?where=")
Call<List<User>> getFollowers(@Query("followings.objectId") String objectId);
This interface call puts an ampersand before the query parameters and generates a URL like below
I tried to overcome this with Path annotation but i keep getting "URL query string must not have replace block. For dynamic query parameters using @Query" error.
API that i am trying to connect requires a "where=" clause for filtering by design. I have no permission to change that. What i want is somehow tell Retrofit not to put an ampersand sign before the query parameter or any workarounds for this issue.
Any help is appreciated.
@GET("{path}") Call> getFollowers(@Path("path") path, @Query("followings.objectId") String objectId);
getFollowers("Users?where=", ...)
For those who seek for similar answers, I came up with below solution
I declared my interface with @Url
and generated related URL part as an extension method