I have an endpoint that returns whether a resource is valid or not (true
or false
):
GET resource/{id}/valid
Where the returned value is not a field of the resource and is dynamic, it does not depend on the resource alone but on other factors that can change in time, meaning that if I call it today and returns true, tomorrow may return false on the same resource.
According to REST naming conventions adjectives - such as "valid" - should not be used but I am struggling finding a better alternative. Even if /valid
does not follow the REST conventions it does a good job in conveying what the endpoint is expected to return.
What is the recommended way to name such endpoints?
Edit: great arguments in the answers, thanks everyone for their contribution! I want to add that a requirement here is to return only true
or false
, in order to minimize network utilization and serialization and deserialization processes.
/resources/{id}/status {"valid":true}
. Remember that URLs are meaningless. You are the only one striving to provide some sort of literature. The HTTP Client won't care at all.