Should a view flag be updated by API or the consumer?

152 views Asked by At

I do hope this question is too subjective, as I am actually looking for a "best practice" that makes sense. However, the question is a bit more broad than just this case.

Lets say I have a view flag on an object (seen or not). When this object is seen, I see three options to make it true:

  1. Let the app consumer set it by issuing an UPDATE call
  2. When we call the GetObject method, we automatically set "seen" to true
  3. We add a method in the API saying SetToSeen which the consumer is responsible to set

What is the favorable approach here?

1

There are 1 answers

0
sschrass On BEST ANSWER

for me it depends on who uses this flag.

If it is the client, then the client should update the object (maybe "seen" could read as "displayed to the user") like PUT /object/{id}/seen.

If it this is only for the server and read as "displayed to the client", then the server should update if the object was served.