January 2019
Intermediate to advanced
378 pages
11h 35m
English
Define a new header that contains the version number in the request as part of request header itself. A custom header allows the client to maintain the same URIs, regardless of any version upgrades. This implementation is the kind of content-negotiation that we saw in Chapter 2, Design Strategy, Guidelines, and Best Practices and we'll see it in the next section as well. The following code snippet will help us understand the version implementation through a custom header named x-resource-version. Please note that the custom header name can be any name; in our example, we name it x-resource-version:
@GetMapping("/investorsbycustomheaderversion")public List<Investor> fetchAllInvestors...(@RequestHeader("x-resource-version") ...Read now
Unlock full access