Using GET with url path variables in a RestController in Java Spring

Spring Boot is one of the most heavily used convenience frameworks within the Spring ecosystem.

Some good documentation.

The @RestController annotation helps to easily implement a Rest API within your app. This is how you can implement an HTTP GET request with variables derived from the path.

...
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MainApi {

    @GetMapping("/api/calendar/{userid}")
    public MyCalendar getMyCalendar(@PathVariable("userid") String userId){
...