Open APIs

 View Only
  • 1.  Routing to different similar domain systems based on the @type for GET calls

    Posted Feb 07, 2023 12:29
    Hello Team,

    Considering a scenario where in we have two different systems which comprise of the customer information ( e.g. taking Customer domain as example ) and has to be routed to both of it but the endpoint would be same as /customerManagement/customer and to contain the different attributes we have two schemas. Both are going to extend the same Customer schema as shown below. 

    AbcCustomer -> extends -> Customer 
    XyzCustomer -> extends -> Customer 

    In case of POST call, since the payload will have the "@type" ( defined like "@type: AbcCustomer" or "@type: XyzCustomer"  ) which is the discriminator factor, with this the different system service flows are possible to route in the code. Its easy in case of POST because we get the respective polymorphic type in handlers.

    But in case of the GET, how is this possible, should we be using the filter like below to route the flows, because 11111 is the customer identifier managed by the system A and abc2222 is the customer managed by the system B. 

    /customerManagement/customer/11111?@type=AbcCustomer
    /customerManagement/customer/abc2222?@type=XyzCustomer

    Request for any other ideas in these GET calls.






    ------------------------------
    Kartik N Maringanti
    Verizon
    ------------------------------


  • 2.  RE: Routing to different similar domain systems based on the @type for GET calls

    Posted Feb 07, 2023 12:34
    Team,

    Apologize for the typo in the title, could not edit it. Its regarding "How to achieve routing between the different systems falling under same domain API specification especially for GET calls"

    ------------------------------
    Kartik N Maringanti
    Verizon
    ------------------------------



  • 3.  RE: Routing to different similar domain systems based on the @type for GET calls

    Posted Apr 25, 2023 08:57
    Edited by manuel pastor Apr 25, 2023 10:19

    -- Removed as Duplicate --



    ------------------------------
    manuel pastor
    Salesforce
    ------------------------------



  • 4.  RE: Routing to different similar domain systems based on the @type for GET calls

    Posted Apr 25, 2023 08:58

    Hello Kartik, pity there has been no comment to your request. I wonder if you ever found a solution ... I came across the same problem when we need to have two different document management systems for different types of documents, using TMF667. How to manage the routing to the appropriate host using the same API path, otherwise we would need to implement the API twice, which is not optimal. Let me know if you had any good idea.



    ------------------------------
    Manuel Pastor
    Salesforce Industries
    ------------------------------



  • 5.  RE: Routing to different similar domain systems based on the @type for GET calls

    Posted Apr 28, 2023 06:01

    Hi Kartik,

    who do you need to handle the mapping to the appropriate system? If you are using an API gateway, you can implement the routing there, based on a path variable:

    /customerManagement/{customerType}/customer/{id}
    /customerManagement/AbcCustomer/customer/11111
    The API GW can resolve the customerType variable to point to the right producer.

    If you are not using any API Management component, I guess you could also use the server templating to point to the appropriate host based on variables, but the consumer would need to know in advance wich system to call... And its a swagger 3.0 feature not available in 2.0; but maybe can be used without any upgrade
    Take a look: https://swagger.io/docs/specification/api-host-and-base-path/
    Rgds,



    ------------------------------
    manuel pastor
    Salesforce
    ------------------------------