I have been developing a custom media type for the RESTful API and have studied the types and semantic meaning of some standard link relationships to give my design some control.
To demonstrate the problem, let's say that I have a resource on which I can execute standard methods of reading, changing, deleting, and that I use the idioms HTTP GET, PUT and DELETE respectively to implement these methods.
I could intelligently (re) use the βeditβ link link (from the IANA Link Registry ) as defined in RFC5023 , which states:
"... The value" edit "indicates that the value of the href attribute is the IRI of the member's record being edited. When it appears inside atom: entry, the IRI href can be used to retrieve, update, and delete the resource represented by this record ...."
Thus, the user agent can understand that the link with the "edit" relationship will allow the resource to be GET, PUT, and DELETEd.
However, this is the problem, if the state of the resource is edited in such a way that the resource now supports only GET and DELETE operations, the "edit" relation is no longer accurate.
To maintain accuracy, I need to either i) OPTION A: specify a different (compound) link relationship that supports only GET and DELETE, or ii) OPTION B: specify separate links for each possible state transfer and use the appropriate ones to indicate allowed state transfers. The latter approach offers accuracy, but looks too verbose.
Alternatively (OPTION C), I could leave the "edit" relationship in place and accept the lack of precision, i.e. the link will pass the semantics of GET, PUT, DELETE, but a user agent trying to execute PUT will be met using HTTP Error '405 - Method not allowed'. However, I am not happy with this approach, as this means that the client is transitioning to a state that is not supported.
So the question is, what is the most reasonable way to balance commonality of relations and accuracy?