rest2go icon indicating copy to clipboard operation
rest2go copied to clipboard

methods on non-ID-resource – separate methods?

Open Kissaki opened this issue 14 years ago • 1 comments

#8 implemented DELETE on resource (non-ID). Same with #7 .

Should a new method be used to pass it, or is passing an empty id sufficient and clear enough for the end-user?

For GET one is Find, the other is Index. They are very different in usage. OPTIONS for example, on the other hand, does the same for both kinds of resources, with and without ID. DELETE is either delete one or clear, so a "Clear" method would be a good name. PUT to replace entire collection: "Replace" instead of Update? POST is supposed to create a sub-collection toe the ID-res. "Fork"?

In general, this issue may be associated with #5 as a more generic URL-to-Resource mapping could help out here, at least for the POST-case, which is supposed to create sub-resources. That case should be a very rare one though …

Kissaki avatar Jun 09 '11 02:06 Kissaki

The function names were derived from the ones used in Ruby on Rails.

Options has to distinguish when it is used one way or the other. Delete could work the same way.

Nathan

On Thu, Jun 9, 2011 at 04:48, Kissaki [email protected] wrote:

#8 implemented DELETE on resource (non-ID). Same with #7 .

Should a new method be used to pass it, or is passing an empty id sufficient and clear enough for the end-user?

For GET one is Find, the other is Index. They are very different in usage. OPTIONS for example, on the other hand, does the same for both kinds of resources, with and without ID. DELETE is either delete one or clear, so a "Clear" method would be a good name. PUT to replace entire collection: "Replace" instead of Update? POST is supposed to create a sub-collection toe the ID-res. "Fork"?

In general, this issue may be associated with #5 as a more generic URL-to-Resource mapping could help out here, at least for the POST-case, which is supposed to create sub-resources. That case should be a very rare one though …

Reply to this email directly or view it on GitHub: https://github.com/Kissaki/rest.go/issues/11

nathankerr avatar Jun 09 '11 14:06 nathankerr