How frequently does the letter s appear in:
Q: REST API Design: Multiple calls vs. single call to the API We are developing a Rest API for eCommerce website which will be consumed by mobile apps.
In the home page of an app we need to call multiple resources like Sliders, Top Brands, Best Selling Products, Trending Products etc.
Two options to make API calls:
Single Call:
www.example.com/api/GetAllInHome

Multiple Calls:
www.example.com/api/GetSliders

www.example.com/api/GetTopBrands

www.example.com/api/GetBestSellingProducts

www.example.com/api/GetTrendingProducts

Which is the best approach for  rest api design - single or multiple call, explain the pros and cons?
Which will take more time to respond to the request? 

A: In Theory the multiple simultaneous calls are more flexible and just as fast.
However, in practice if you load a page, and then load each part of that page, displaying loading spinners all over it until you get the results back the result is slow and disjointed.
For this reason AJAX requests for data should be used sparingly and only when you have a section of the page which is slow to load or needs to be refreshed on a different cycle to the rest of the page. Say a master/detail display, where you want to select an option from the master and display the corresponding detail without reloading the master.
A common design is to keep the separate APIs for coding flexibility and micro-service concerns, but combine the data server side in the website. so that the client needs to make only a single call to its own website. The API calls with appropriate caching should be fast within the data center.
Also, consider having NO client API calls at all. simply generate the HTML server side. Although javascript single page app frameworks push you down the api route. Its usually not the optimal approach for high volume e-commerce sites.


A: TL;DR: All other application considerations aside, performing a single call would be faster than performing multiple calls. Running the calls asynchronously may cut down the overall time needed to complete a given operation from the perspective of your user (which might well be all you need), but in aggregate, the time taken would still be longer for multiple calls.
In your case however, im not sure thats the full story.
REST APIs are a slightly ambiguous term, due to various interpretations of the paper that made the idea popular. By even the most liberal interpretation of what constitutes a REST API however, what you have doesnt really fit. 
The core principle is that you have a resource on which you want to perform an action. The URI identifies the resource you are interested in, and you would normally use the HTTP verbs to indicate what you want to do to that resource. 
In your specific case, all of your methods have the word get in their name. You should be changing the verb used in the HTTP request to indicate that you want to get the resource available at that location.
Your URI scheme should represent the logical hierarchy of the resources you want to make available to the users of your API, so in your case i would consider using something like /api/products?category=sliders to filter down your collection of products. This means that when clients want to get all of your products, they can simply omit the query string.

user
There are one hundred and seventy "s"s.
assistant