Question
Pegasystems Inc.
JP
Last activity: 28 May 2020 16:24 EDT
Standard practice to have multiple versions of REST API available at the same time
Hi,
If I want to have multiple versions of REST API running at the same time, what is the most standard practice? The Consumer should be able to call both the versions. The service package is the same, only difference in the endpoint URL is the version. Example below.
https://myserver/prweb/PRRestService/myservicepackage/v1/myservice
https://myserver/prweb/PRRestService/myservicepackage/v2/myservice
The possible approaches are:
1. Create multiple Service REST rules for each version. And, create Service Activities per version but with different names (PostOrder_v1, PostOrder_v2, etc).
2. Create multiple Service REST rules for each version. And, create classes per version (v1, v2, etc). You can make new class inherit from old class by Directed Inheritance for reuse.
3. For the client to pass the version in the request header. Map the version to the clipboard, and Service Activity uses this information to determine the version of the data to return to the caller.
What is the recommended way to achieve this?
Thanks,