I was going through an old, largely untouched part in my company’s codebase and found one API. It does the following things.
A POST API with path host/entities/trigger which fetches a list of entity IDs from the database. For each of these entity IDs, it’s making another POST call to the below API in the same service (host/entities/{entityId}/process) which does sole operations based on the entity ID.
My doubt is, what is the point of having it like this? Because, we can simply have the first API, and instead of making the second API call to the same service, we can just call the process() function. Are there any disadvantages of doing it like this? Or, are there any advantages doing it in mentioned format above?
an old, largely untouched part in my company’s codebasethenwe can just call the process() function.might not be that simple. It will depend on the dependency graph, abstractions, complexity (aka spaghetti code), etc.