API Connect

 View Only
  • 1.  Best developing approach for the public portal APIs with multiple versions

    Posted Thu June 22, 2023 10:35 AM

    Hi All,

    We are developing public APIs which has multiple versions and each version has its own subscribers, We are analyzing the best recommended approach for developing such APIs, Below are possible 2 approaches and we are in the process of picking 1 which is recommended.

    For the argument sake lets assume we have a booking API and it has 2 versions and each version has its own subscribers.

    Approach 1. 

    • Create 2 products "booking_1.0.0" and "booking_2.0.0" and associated APIs "booking_api_1.0.0" and "booking_api_2.0.0" under the same booking folder with 1.0.0 and 2.0.0 as subfolder sharing the same service register file.
    • Deploy 1.0.0 API first and it will be shown in published state, Later Deploy 2.0.0 API , As the product name is same only version is changing while deploying 2.0.0 API, 1.0.0 product will goes to deprecated state and 2.0.0 product will be shown in Published state.
    • This way both APIs are accessible from their respective subscribes.

    Approach 2.

    • Create 1 product "booking_1.0.0" associating with 2 APIs "booking_api_1.0.0" and "booking_api_2.0.0" which will be placed under the folder booking with subfolder 1.0.0 and the same service register file mentioning about both APIs in an array.
    • When we deploy, Both APIs will be deployed together and they will be sharing the single product.
    • However in this scenario in future if we do any enhancement for v2 and deploy, Along with v2, v1 API will also gets deployed without any changes and if there is any downtime for the product both APIs will be unavailable.


    ------------------------------
    Sabari giri Oruganti
    ------------------------------


  • 2.  RE: Best developing approach for the public portal APIs with multiple versions

    Posted Thu June 29, 2023 03:26 AM

    I'd recommend approach 1, thats making proper use of the API Product lifecycle in API Connect.

    It is worth saying that there is no automatic deprecation just because the product names are the same - there is no magic automatic behaviour there since that might not be what everyone wants. When you publish 2.0.0 you can select to "Replace" the original product which will immediately remove 1.0.0 and move all subscribers to 2.0.0, or you can select to "Supersede" the original one which will deprecate the APIs within it and allow the subscribers to migrate over at their own pace. Both versions of the API would stay functional.

    Your second approach basically dooms you to having 2 APIs forever since you will be unlikely to ever move all subscribers over from 1.0 to 2.0 if theyre both within the same product. Essentially thats just doubling the work as you have two completely independent APIs and no real versioning at all.

    Cheers,

    Chris



    ------------------------------
    Chris Dudley
    ------------------------------



  • 3.  RE: Best developing approach for the public portal APIs with multiple versions

    Posted Fri July 07, 2023 06:07 AM

    Hi Chris,

    Thank you so much for your inputs on this query, This helped us to understand the concept better.

    Regards

    SabariGiriOruganti



    ------------------------------
    Sabari giri Oruganti
    ------------------------------



  • 4.  RE: Best developing approach for the public portal APIs with multiple versions

    Posted Mon July 10, 2023 09:29 AM

    If you wish "migrate" (move) their subscriptions in phases. Please see API Products & Consumer Subscriptions. The code is intense -- lots of "jq" gymnastics. You should be able to simplify the code using "yq". 

    I wrote the code to handle API products/plans which had thousands of subscriptions. Even with fewer subscriptions, automation might be useful if you expect to repeat Approach 1 a few times a year.



    ------------------------------
    Ravi Ramnarayan
    Technical Account Manager - Expertise Connect
    IBM
    ------------------------------