Get Ticket Endpoint

In this lesson we'll implement the list ticket endpoint.

Creating the Ticket Controller

We'll start by creating a new controller class to handle ticket-related operations.

Let's create a new TicketController class with the @RestController annotation and set up the base path for our API:

@RestController @RequestMapping(path = "/api/v1/tickets") @RequiredArgsConstructor public class TicketController { private final TicketService ticketService; private final TicketMapper ticketMapper; @GetMapping public Page<ListTicketResponseDto> listTickets( @AuthenticationPrincipal Jwt jwt, Pageable pageable ) { return ticketService.listTicketsForUser( parseUserId(jwt), pageable ).map(ticketMapper::toListTicketResponseDto); } }

Summary

  • Implemented the list ticket endpoint
© 2026 Devtiro Ltd. All rights reserved