Spring Boot: How to Use @PathVariable in REST APIs It's often the case in REST APIs that you need a URL that includes an ID or other variable. That's what makes the @PathVariable annotation in Spring Boot so valuable.