METHOD TO SUPPORT MULTIPLE VERSIONS OF APIS AND TO CONTROL RUN-TIME EXECUTION OF AN API
In an approach to API versioning, annotations are provided to differentiate among two or more versions of an API. Statistics associated with the two or more versions of the API are collected. A call from a client to access one of the two or more versions of the API is intercepted. A best-fit version for the client is identified based on employing analytical elements on the collected statistics. API execution is re-routed to the identified best-fit version during run-time.
1 . A computer-implemented method for API versioning, the method comprising:
providing, by one or more computer processors, annotations differentiating two or more versions of an API;
collecting, by one or more computer processors, statistics associated with the two or more versions of the API;
intercepting, by one or more computer processors, a call from a client to access one of the two or more versions of the API;
identifying, by one or more computer processors, a best-fit version for the client based on employing analytical elements on the collected statistics; and
re-routing, by one or more computer processors, API execution to the identified best-fit version during run-time.
2 . The computer-implemented method of claim 1 , wherein the call from the client to access one of the two or more versions of the API comprises a call to access a previously selected default version.
3 . The computer-implemented method of claim 1 , wherein the annotations are implemented in the form of a programming language extension.
4 . The computer-implemented method of claim 1 , wherein the collected statistics comprise version-specific information related to one or more of stability, execution time, and accuracy experienced by customers using the API.
5 . The computer-implemented method of claim 1 , wherein identifying a best-fit version for the client based on employing analytical elements on the collected statistics further comprises:
receiving, by one or more computer processors, from the client, a selected parameter; and
searching, by one or more computer processors, for the selected parameter in a statistics repository.
6 . The computer-implemented method of claim 1 , wherein the call from the client is intercepted responsive to detection of a performance problem.
7 . The computer-implemented method of claim 6 , wherein detection of a performance problem further comprises:
receiving, by one or more computer processors, a user selection prioritizing a parameter;
analyzing, by one or more computer processors, the collected statistics; and
determining, by one or more computer processors, that performance is poor with respect to the prioritized parameter.
8 . A computer program product for API versioning, the computer program product comprising:
one or more computer readable storage media and program instructions stored on the one or more computer readable storage media, the program instructions comprising:
program instructions to provide annotations differentiating two or more versions of an API;
program instructions to collect statistics associated with the two or more versions of the API;
program instructions to intercept a call from a client to access one of the two or more versions of the API;
program instructions to identify a best-fit version for the client based on employing analytical elements on the collected statistics; and
program instructions to re-route API execution to the identified best-fit version during run-time.
9 . The computer program product of claim 8 , wherein the call from the client to access one of the two or more versions of the API comprises a call to access a previously selected default version.
10 . The computer program product of claim 8 , wherein the annotations are implemented in the form of a programming language extension.
11 . The computer program product of claim 8 , wherein the collected statistics comprise version-specific information related to one or more of stability, execution time, and accuracy experienced by customers using the API.
12 . The computer program product of claim 8 , wherein program instructions to identify a best-fit version for the client based on employing analytical elements on the collected statistics further comprise:
program instructions to receive, from the client, a selected parameter; and
program instructions to search for the selected parameter in a statistics repository.
13 . The computer program product of claim 8 , wherein the call from the client is intercepted responsive to detection of a performance problem.
14 . The computer program product of claim 13 , wherein the program instructions stored on the one or more computer readable storage media further comprise:
program instructions to receive a user selection prioritizing a parameter;
program instructions to analyze the collected statistics; and
program instructions to determine that performance is poor with respect to the prioritized parameter.
15 . A computer system for API versioning, the computer system comprising:
one or more processors;
one or more computer readable storage media; and
program instructions stored on the one or more computer readable storage media for execution by at least one of the one or more processors, the program instructions comprising:
program instructions to provide annotations differentiating two or more versions of an API;
program instructions to collect statistics associated with the two or more versions of the API;
program instructions to intercept a call from a client to access one of the two or more versions of the API;
program instructions to identify a best-fit version for the client based on employing analytical elements on the collected statistics; and
program instructions to re-route API execution to the identified best-fit version during run-time.
16 . The computer system of claim 15 , wherein the annotations are implemented in the form of a programming language extension.
17 . The computer system of claim 15 , wherein the collected statistics comprise version-specific information related to one or more of stability, execution time, and accuracy experienced by customers using the API.
18 . The computer system of claim 15 , wherein program instructions to identify a best-fit version for the client based on employing analytical elements on the collected statistics further comprise:
program instructions to receive, from the client, a selected parameter; and
program instructions to search for the selected parameter in a statistics repository.
19 . The computer system of claim 15 , wherein the call from the client is intercepted responsive to detection of a performance problem.
20 . The computer system of claim 19 , wherein the program instructions stored on the one or more computer readable storage media further comprise:
program instructions to receive a user selection prioritizing a parameter;
program instructions to analyze the collected statistics; and
program instructions to determine that performance is poor with respect to the prioritized parameter.