0

I am writing a GET request (using Angular 10, Spring boot, & Postgres). It does a 'Get' request to fetch 3357 records from a database. Then, it renders it to the UI

    return this.http.get<IFileMetadata[]>(this.resourceUrl, { params: options, observe: 'response' });

The problem is that it only shows 2000 records in the UI, which is not correct, as it should be 3357 records.

Is there any limit for the number of rows that can be returned in a 'Get' request?

cluis92
  • 664
  • 12
  • 35
  • Probably your API only gives 2000 record max. Usually, it should be a param (like "per_page"), which is for get more (i.e: per_page: 9999). I'm talking in "abstract", I don't know how that it works with Spring, sorry. – Juan Vicente Berzosa Tejero Nov 02 '21 at 18:09
  • I think I found the issue here https://stackoverflow.com/questions/23751193/spring-data-jpa-limit-pagesize-how-to-set-to-maxsize – cluis92 Nov 02 '21 at 18:10
  • If Spring works in a different way (It have not "per_page"), you should do it taking care manually of the "pagination". A way of do this could be as @cluis92 shows in his link. – Juan Vicente Berzosa Tejero Nov 02 '21 at 18:13

1 Answers1

1

As an user suggested in his comment, the limit of 2000 records is due to the fact that spring fixes a default 2000 limit per_page stored in the properties spring.data.web.pageable.max-page-size and spring.data.rest.max-page-size property for the maximum size of pages both documented here, so you can add the spring.data.web.pageable.max-page-size= newvalue inside the spring boot application.properties to override the default value or an equivalent method or change the pageable maximum size for spring.data.rest.max-page-size in the same way.

dariosicily
  • 4,239
  • 2
  • 11
  • 17