I am developing an API by looking at the documentation on HTTP methods, which says that "GET" should not change the state of a resource. What if I want to calculate how many times a resource is viewed and return it in response?
Sort of
GET /resource/1
{
"content": "This is the resource 1",
"view_count": 1
}
In the next call, it returns:
GET /resource/1
{
"content": "This is the resource 1",
"view_count": 2
}
Am I breaking a rule?
source
share