Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.
Here’s an outline with best practices for making your inquiry.
My question:
Our API fetches total records/total books. Further it provides details such book id, book name, author name etc. as a array in response.
Now I want to validate the pagination. Suppose the total books is equal to 768, and in the request body I have provided pageSize as 100 and pageNumber as 1, the response I get is something as below.
“totalBooks”: 768,
“Books”:
[
Book1:{
“bookName”: “abc”,
“bookId”: “xyz”,
},
“Book2”:{
“bookName”: “abcqw”,
“bookId”: “xyzplpkj”,
},
“Book3”:{
“bookName”: “abcpqr”,
“bookId”: “xyzghj”,
},
.
.
.
.
.
Book100: {
“bookName”: “asfabc”,
“bookId”: “xyzpoi”,
}
]
So ideally I should be getting 8 pages, first 7 pages should have 100 each and the last page should have 68. How can I validate the pagination that each page is having 100 books each.