Search code examples
api-design

API call on Demand or one API Call


I have this scenario where there are multiple Help buttons which may or may not be clicked. Now, I am very confused to send all information(including the text after user click help buttons) at once, or every time user clicks on one of help button make the API call and send the Response. What I see is there can be case of Network Overload when you make Multiple calls but at the same time my seniors suggest its for - 1) API Best Practices 2) Design Practices and 3) API splitted into Granular Level.

I couldnt find any convincing answer for this anywhere and found only Tutorials for "How to make an API ?"


Solution

  • It depends on the expected network latency (ping time) between your clients and your server. In a high-latency situation with otherwise good bandwidth (e.g. mobile apps), many small requests will perform significantly worse than one large one.

    Also, having one big request can help with