2 Versionning Rest API Using Request Parameter Versioning

 2.Request Parameter Versioning

  •     http://localhost:8080/person?version=1
  •     http://localhost:8080/person?version=2
Step 1: VersioningPersonController.java

public class VersioningPersonController {

@GetMapping(path="/person", params="version=1")

public Personv1 getFirstVersionOfPersonRequestParameter() {

return new Personv1("Irfan pathan");

}

@GetMapping(path="/person", params="version=2")

public Personv2 getSecondVersionOfPersonRequestParameter() {

return new Personv2(new Name("Irfan", "Khan"));

}

}


with

http://localhost:8080/person?version=1



with

http://localhost:8080/person?version=2




Comments

Popular posts from this blog

Introduction of RESTful Web Service

Learn JPA and Hibernate

Implementing Dynamic Filtering for Rest API