I am creating a database server with resources with 'lastAccessed' datetime field. This field must be updated with the server's time with every read, but not query. How should I design the REST API if I want to allow clients to update this field at will?
I thought of several options, but none of them seem correct...
GET /api/resources/{resource_id}Even though this is a GET, it updates the 'lastAccessed' field.
PATCH /api/resources/{resource_id}with{ lastAccessed: "garbage_value" }Value from the client is ignored and 'lastAccessed' is updated with the server time.
POST /api/resources/{resource_id}/update-last-accessed-timewithout payloadSpecial endpoint for this purpose agreed on contract
PUT /api/resources/{resource_id}/lastAccessedwithout payloadIntention of this API is to convey that this call will replace the 'lastAccessed' field with the server's default value, in this case, server's time.