-
Notifications
You must be signed in to change notification settings - Fork 71
Url query params
Orhan Obut edited this page Aug 9, 2015
·
2 revisions
@Query is used to add query params
@GET("/users/repos")
void fetchRepoBySearch(
@Query("page") int pageNumber,
@Query("sort") String sort,
Callback<Repo> callback
);
service.fetchRepoBySearch(2,"asc", callback);
//output url is ENDPOINT/users/repos?page=2&sort=asc
@QueryMap is used to add query params using a map
@GET("/users/repos")
void fetchRepoBySearch(
@QueryMap Map queryParamsMap,
Callback<Repo> callback
);
Map<String,String> map = new HashMap<>();
map.put("sort","asc");
map.put("offset", "100");
service.fetchRepoBySearch(map, callback);
All contributes are welcome.