Replace an Outdated API

How to use a new API service in your existing business logic.

Companies older than five- to ten-years-old lose time and money when replacing legacy services in their IT infrastructures. Often, they are connected to other IT systems in unexpected ways through legacy integration services. Legacy integrations impose a number of risks if they run undocumented, untested or unmonitored in production. Furthermore, existing and upcoming privacy regulations create a need to manage their logs and connected data stores transparently.

In an offer calculation pipeline, use Xapix to replace a legacy currency rate service. Create a version switch in the pipeline to learn about the decision unit and its frequent companion, the merge unit. Create a transform unit to adapt your new currency rate service response to the legacy service’s output format.

Steps
Steps
  1. Create or login to your Xapix account and import the Onboarding Exercises project template.

  2. On your onboarding exercise project’s home screen

    • click on the endpointGET /{api_version}/my-product-offer/{offer_id}

    • select Edit Pipeline to get to your offer calculations pipeline dashboard.

  3. In the pipeline, click on the Decision unit and add a new branch by clicking the new branch symbol in the upper right corner of the screen.

    • Enter a telling name, e.g. “new-api-v2”, and copy the formula from the v1 branch

    • Change the conditional to “v2”.

    • Click Save and then Done to return to the pipeline dashboard.

  4. Back in the pipeline, click Add Unit on the upper left corner. In the overlay dialogue, add the "exchangeratesapi.io latest" Connector unit to the pipeline.

  5. Then, click Add Unit again and this time add a Transform unit to the pipeline.

  6. Now, back on the pipeline dashboard

    • connect your v2 branch of the Decision unit with the "exchangeratesapi.io" Connector unit

    • connect the "exchangeratesapi.io" Connector unit with your new Transform unit and the Transform unit with the Merge unit.

  7. Click on the Transform unit and mimic the legacy connector’s response format.

    • Add a new property "body" of type object.

    • Add two attributes named "EUR_USD" and "api_version", both of type “literal”.

    • On the left side of the screen, showing the response body from the "exchangeratesapi.io" Connector, scroll down to the attribute "USD" nested in the rates object and drag and drop it over to your new property "EUR_USD".

    • For the "api_version" property enter a fixed string, such as “exchangerates_io 2020”.

  8. Use the Publish button to deploy your project.

  9. Finally, test whether the response matches your expectations by copying the cURL command in the bottom right corner into a new terminal window on your computer.