Change the hint_panels/move
endpoint to a noun to follow REST API best practices
#64
Labels
cleanup
Too small to be a true "refactor," but same idea
Background
It is possible for users to change the order of hint panels within a hint profile. This should be a distinct operation from the normal hint panel
#update
CRUD method due to movement affecting other panels besides just the moved panel. Because of this, the required data for the#move
endpoint is different from#update
. It would theoretically be possible to only include data for the panel being moved by sending something like{ id, newIndex }
to the endpoint, but this still feels distinct from#update
due to the fact that it affects other panels besides just the moved one.Next Steps
Since the
#update
method uses PUT or PATCH withhint_panels/:id
, one possibility would be to use thehint_panels
URL with PUT or PATCH and no hint panel ID. This would also be distinct fromindex
due to using PUT/PATCH instead of GET (if index is ever re-implemented). The downside is that it would not be immediately obvious that this URL pattern is for moving hint panels as opposed to, say, bulk updating them more generally.Another option would be to change the url to
/mover
or/movement
instead of/move
. While these would satisfy the condition of making the URL pattern into a noun, they would be much less clear thanmove
and would therefore be bad for a different reason.Maybe something like
/order
or/sequence
could be used? Those both convey what is happening much more clearly.An even clearer approach would be to change this operation to be associated with a specific hint profile rather than hint panels.
user_hint_profiles/:id/panel_order
is much more effective at conveying what is happening thanhint_panels/order
. This is probably the approach to take.The text was updated successfully, but these errors were encountered: