Reputation: 920
I want to customizer my endPoint using Retrofit2 on Android but I have a doubt.
If I do that:
@GET("Search") //i.e https://api.test.com/Search?
Call<Products> getProducts(@Query("one") String one, @Query("two") String two,
@Query("key") String key)
My endPoint could be like this:
//-> https://api.test.com/Search?one=Whatever&two=here&key=SFSDF24242353434
I'm working with this endPoint:
// -> https://example.com/third-party-public/categories/category_id.json
If I use the same ideia as I explained above the result can be is:
@GET("/third-party-public/categories/")
Observable<List<Category>> getCategoryDetail(@Query(".json") String category_id);
The result could be:
// -> https://example.com/third-party-public/categories/.json=1
But I want that result
// -> https://example.com/third-party-public/categories/1.json
How can I setting my @query for get that result?
Upvotes: 0
Views: 187
Reputation: 1493
If you set a request with query it sets as query param '?'.
If the result you want is that you simply use it as in path:
@GET("Search/{fileUri}")
Call<Products> getProducts(@Path("fileUri") String fileUri);
You get the value it as "1.json".
Upvotes: 1
Reputation: 11992
@GET("/third-party-public/categories/{category_id}.json")
Observable<List<Category>> getCategoryDetail(@Path("category_id") String category_id);
Upvotes: 1