Click here to Skip to main content
15,887,683 members
Articles / General Programming / Architecture
Tip/Trick

3rd Party API Integration Pattern

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
14 Nov 2023CPOL2 min read 5.6K   3   2

Overview

Most applications at the enterprise, mid-size, or even startup levels, would have one or more 3rd party APIs they integrate with. It may start off with just one component talking to the external API, but can very quickly grow into multiple systems talking to that 3rd party API. It’s not a good practice to have direct integrations for all those different systems. Instead, a good pattern is to have a 3rd Party API Integration Service, deployed as a company wide API, where this API acts as the gateway between the 3rd party system and systems within your application / enterprise.

Integration Service Pattern

Image 1

The benefits of this pattern are mainly that the integration service insulates the rest of the ecosystem from the external API. This helps avoid negative coupling spread throughout the system as well as redundant codebases that could all very quickly go out of sync. All interactions are done in one system and one codebase, which makes it significantly simpler to maintain. Most such integration services often serve multiple functions.

  • Authorization – All of the auth code to the 3rd party API is managed in this one service.
  • Caching – If the 3rd party API is expensive or not as performant as you’d like it to be, you can add a fast caching layer here (and use something like Redis for recent repeat calls).
  • Schema Transform – You can transform the schema to a more company compliant standard.
  • Data Filtering – This would be a simple place to filter out certain results or certain fields within results.
  • Model Enrichment – You can enrich the 3d party response by adding internal system identifiers, which will make it far easier for downstream callers to resolve entities.
  • Local DB persistence – All fetched data can be persisted locally, meaning that in a future scenario where the 3rd party API may not be available to integrate with, you still have the original data.

And the fact that you have this integration service means that you can switch 3rd party services without the internal systems having to make any changes. A new version of the integration service will abstract away the new external API and convert the data to the same format expected by the downstream callers.

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
Nish Nishant is a technology enthusiast from Columbus, Ohio. He has over 20 years of software industry experience in various roles including Chief Technology Officer, Senior Solution Architect, Lead Software Architect, Principal Software Engineer, and Engineering/Architecture Team Leader. Nish is a 14-time recipient of the Microsoft Visual C++ MVP Award.

Nish authored C++/CLI in Action for Manning Publications in 2005, and co-authored Extending MFC Applications with the .NET Framework for Addison Wesley in 2003. In addition, he has over 140 published technology articles on CodeProject.com and another 250+ blog articles on his WordPress blog. Nish is experienced in technology leadership, solution architecture, software architecture, cloud development (AWS and Azure), REST services, software engineering best practices, CI/CD, mentoring, and directing all stages of software development.

Nish's Technology Blog : voidnish.wordpress.com

Comments and Discussions

 
GeneralAPI Integration Pin
Joe Henderson 202215-Nov-23 11:49
Joe Henderson 202215-Nov-23 11:49 
GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA14-Nov-23 13:13
professionalȘtefan-Mihai MOGA14-Nov-23 13:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.