I need to track entity view count.. for example I have a Product
entity and have the following API endpoint:
GET /products/{productID}
In case I want to track a view count of a particular Product
should I add additional logic that will increment view count when I call this /products/{productID}
endpoint? Or I should introduce a separate endpoint for this purpose?
UPDATED
Maybe I was not clear on my question but my question is about best practice for updating counters with REST API and not about multi-layer architecture. I'm trying to ask the following - should I update the counter by mentioned GET
request or I should introduce another API.. let's say POST /products/{productID}/viewings
and call it subsequently after the GET
in order to update the counter?