[openstreetmap/openstreetmap-website] Add Messages API (PR #4605)

Andy Allan notifications at github.com
Wed May 29 18:36:04 UTC 2024


@gravitystorm commented on this pull request.



> @@ -78,6 +78,15 @@
       end
     end
 
+    resources :messages, :path => "user/messages", :constraints => { :id => /\d+/ }, :only => [:create, :show, :destroy], :controller => "messages", :as => :api_messages do

In general I would not recommend any nesting. I would only add the nesting if either:
* There's a need for the id of the parent object (e.g. /node/:id/relations), or
* There's a need to disambiguate between two same-named controllers (e.g. the classic `/admin/users/`)

However, in this particular case, I support @milan-cvetkovic , since it actually matches our existing API. As far as I can tell, almost every existing call where the responses are specific to the current user (and don't refer to public objects) are nested under `/user`:
* /api/0.6/user/details
* /api/0.6/user/gpx_files
* /api/0.6/user/preferences

However some are not:
* /api/0.6/permissions

(There are other calls where it's a user-specific action on an otherwise public object, like subscribing to a changeset, but I treat these as a different situation than the above).

So I think we should add the nesting for messages too, purely for consistency, even though I don't like it!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4605#discussion_r1619323343
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4605/review/2086140430 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240529/88facde3/attachment-0001.htm>


More information about the rails-dev mailing list