Answer the question
In order to leave comments, you need to log in
How to query multiple pages?
Hello,
There is an api, a request to which gives a maximum of 1000 results and then standard pagination, i.e. is page={1,...,n}. The question is how to execute the query correctly and get all the data using retrofit ? I understand that you can check the response.body, but how to implement this does not reach. I don't want to use loops and recursion. The call goes like this ( getCities takes the page as the first parameter, if this is not done, the result is still limited to 1000 objects ):
mService.getCities(1, new Callback<GetCitiesResponse[]>() {
@Override
public void success(GetCitiesResponse[] getCitiesResponses, Response response) {
Log.i(LOG_TAG, "Founded " + String.valueOf(getCitiesResponses.length) + " items");
}
@Override
public void failure(RetrofitError error) {
error.printStackTrace();
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question