Dynamic Database Driven External API Call Service: Seeking direction/terms to focus research on.
Thank you in advance for any responses i get. I’m here seeking a direction for research and any related guidance.
The project in question is written in .NET. However, if the specifics of my question are not appropriate for this subreddit, my apologies, and please point me to what subreddit(s) you think this would be more appropriate for in that case.
I am currently tasked with a work project to attempt to convert an existing service to be more database driven. First, some relevant context:
The service my company provides involves processing applications for individual clients, and as an application moves through it’s stages, we send updates back to the client’s Application Tracking System via API calls. Internal to my company, when an application hits a new stage, it makes a call to the service i’m working on, and then that service has a massive switch statement in it that has the specifics needed to send an update to a given client, keyed off of the client’s ID we internally assigned it.
Everything regarding the structure of the API Call made to update the client is contained in this switch statment, from media-type, headers, format of the body, and the conditions to evaluate for the client’s response to determine if the update was successful.
I’m having difficulty trying to find a rational and safe way to setup this service to be more dynamic, and not require a code change every time a new client is on-boarded, or an existing one needs a change made to how we send them an update (which is the current process).
While i can see a fairly straightforward way to configure things so that things like the headers and even the body can be pulled from a table with a foriegn key from a table with client details (i.e. body can be written in whatever needed format, with string replacement keys embedded in them to be replaced with the specific update data), The major stumbling block for me is how to safely store and pull the success conditions for each client.
Some clients send us a response with misleading HTTP Codes, and the service is set to then evaluate the body to determine if it was a success or failure, among other oddities that are client specific.
I’ve been trying to find a research lead online, but have not yet stumbled across any terms that led me to meaningful relevant information.
Are there any existing patterns for something along the lines of what i’m trying to achieve?
For further reference, my company used to create a new service for each client years ago, and all this would be hard-coded in that service for that client, but in the more recent years they made this ‘generic’ updater service, where the client-specific logic was in a massive switch statement.
This project is written with .NET Core 6, though i plan on updating it to 8 in the process, if that has any effect on how i go about this.
Database platform is Microsoft SQL Server.
I’m sure there is more relevant information that i may not have included, if so, i’m happy to provide additional details, so please ask.
I’m very hopeful that i can at least get a few terms/concepts to focus my research on, or a pointer to any existing projects that might exist that do something similar to this.
Thank you again for any that have read this far and are willing to give guidance.
I have tried configuring string replacement payloads for both json and xml stored in a table successfully. I have been unable to define success conditions in a table in a way that is safe.
Whimsicalknight is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3