Including "Favorite" Status in Products JSONAPI Response

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
Jairus34
Posts: 31
Joined: 05 Aug 2024, 07:34

Including "Favorite" Status in Products JSONAPI Response

Post by Jairus34 » 16 Nov 2024, 00:28

Hi,
I’m currently working on a feature related to user favorites and was wondering if there’s a way to include a product’s "favorite" status directly in the main products API response. I know there’s a separate GET endpoint for fetching a user’s favorite products, but I’d like to include this information when we fetch the product list itself. This would make it a lot easier for our React frontend. Has anyone done this before or have any ideas on how to implement it?

Thanks

User avatar
aimeos
Administrator
Posts: 8620
Joined: 01 Jan 1970, 00:00

Re: Including "Favorite" Status in Products JSONAPI Response

Post by aimeos » 18 Nov 2024, 08:41

At first, adding the customers' favorite status to the product API response sounds nice to simplify your frontend implementation but this has a big drawback! Currently, the product API response is stateless and can be cached by a reverse proxy for a longer time to get low response times and a high number of requests per second. If you make the data in the request stateful, this isn't possible any more and each request must be generated by the application to inject the customers' state for the product. This will significantly increase the response time and will drastically lower the requests per second your server can handle.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply