In my company we made almost every system in micro-service architecture. I working on the backend system, we have many api that working separately from each others. Today We're come up with the question that which component should have the responsible to give front end the data their required.
Let's say we have
- Customer API which :: handle the request that related to customer data
- GiftCard API which :: handle the request that related to giftcard data
We have the story to made our website header show 'total amount of the giftcard that customer has'. GiftCard Api already has the endpoint to get this data but for this story, we're all agree that FE should called to Customer API and Customer API should called to GiftCard Api to grab that data and return to FE because customer's total giftcard balance is basic customer's information which customer api should provide.
But should Customer API be the one who has responsible to return the list of the giftcards information that customer has to FE as well? (RetrieveCard endpoint which required member id as a parameter) We're arguing about that.
Some said we should let's FE called to GiftCard API to get that data because customer's giftcards information are 'Cards information' exist in the GiftCard service level which giftcard api should provide while customer's total giftcard balance is basic customer information which customer api should provide like I mention before. (And this is what happen in our company right now. FE > GiftCard API directly)
Others said we should change the way we're doing right now to let FE called to Customer API instead of GiftCard API because, anyway, giftcards are own by customer so Customer Api should be the one take this responsible. (FE > Customer Api > GiftCard API)
Right now I'm convinced with the second opinion but I still skeptic about that and want to here the opinion from your guys.
Thank you in advanced!
Edit :: In my company the frontend team already has the system called frontend service which provide the data to the frontend stuff by called to multiple backend service and manage the data first. But they want to change the front end service to called to only 1 endpoint if possible. In this case, for the second option, its mean they want to called to Customer API only and let the Customer API called to GiftCard API by itself.