REST

How to control version?

white_cheetah 2022. 9. 30. 14:59

There are 4 methods

1. URI
    @GetMapping(path = "/v1/users/{id}")  //uri

2. Request Parameter
    @GetMapping(path = "/users/{id}", params = "version=1")   //request param

3. mime type
    @GetMapping(path="/users/{id}", headers="X-API-VER=1")    // header

4. header
    @GetMapping(value = "/users/{id}", produces = "application/vnd.company.appv1+json") //mime type