If I have a new version of API implemented using API versioning of the form
/api/v3/example/resource
, and I wish to Reject request of form /api/v1/**
, /api/v2/**
etc.
for all the requests having this structure, how can i do that ??
You could add the following request handling method to your controller with mappings for all your deprecated paths:
@RequestMapping(value = {"/api/v1/**", "/api/v2/**"})
public ResponseEntity<?> deprecatedVersions() {
return new ResponseEntity<>(HttpStatus.GONE);
}