Brandon Hassler
 · Partner Advocate at Xano

Noob Question: One API Endpoint or Multiple?

Answered

Let's say I have a table called /products with 4,000 items. On the front of my site, all of the main searching & filtering will go directly through the /products API endpoint.

But let's say I have other uses of that table, such as:

  • Finding the average price of products that meet certain criteria.
  • Finding the top 5 products that meet a certain criteria.
  • Etc.

Let's say 80% of the website activity is using the /products endpoint to search for products. When it comes to adding other uses of that table (that involve evaluating all of the products in the table based on a set of criteria) is there any wisdom in creating a separate API endpoint for those to 'ease the pressure' of the main /products endpoint? Or is it best to use a single endpoint and, based on the inputs, the function stack uses IF/THEN statements to determine the response?

Does that question make sense?

2 replies