Given an existing set of records tied to a given unique identifier (a.k.a. slug), which is a portion of a key for multiple related records, what HTTP method is appropriate for updating such records to a new unique identifier?
OPTIONS, GET, PUT, POST, HEAD, DELETE, TRACE, and CONNECT all seem irrelevant to the functionality in question.
I'm reluctant to create a separate set of URIs that represent 开发者_开发知识库the "update slug/identifier" functionality when the URI schema is well established.
Thoughts? Opinions?
I'm reluctant to create a separate set of URIs that represent the "update slug/identifier" functionality when the URI schema is well established.
If I am interpreting you correctly then you are going find REST very difficult. In RESTful design, it is very common to have to create new resources to help work around the limited set of methods.
To answer the question directly. I would consider something like,
GET /recordsets/{oldslug}
to retrieve the items you wish to change the slug for and then
POST /recordsets/{newslug}
to assign the new slug to recordsets passed in the body. If for perf reasons you do not want to roundtrip the recordsets you could do,
POST /recordsets/{newslug}?source=/recordsets/{oldslug}
精彩评论