Skip to content

Conversation

@trivedi089
Copy link

This PR introduces pagination and sorting support for the GET /owners endpoint in the Spring Petclinic REST API.

Changes Made:
• Updated OwnerController to accept Pageable as a parameter.
• Modified OwnerRepository and service layer to return Page instead of List.
• Updated JSON response to include standard Spring Data pagination metadata (pageable, totalElements, totalPages, etc.).

Example :
API : GET http://localhost:9966/petclinic/api/owners?page=0&size=5&sort=lastName,asc
Response :
{
"content": [
{ "id": 1, "firstName": "George", "lastName": "Franklin", ... }
],
"pageable": {
"pageNumber": 0,
"pageSize": 5
},
"totalPages": 2,
"totalElements": 10,
"last": false,
"first": true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant