Skip to content

feat(occ): Add commands to list all routes and match a single one - #53669

Merged
nickvergessen merged 1 commit into
masterfrom
feat/noid/add-command-to-list-all-routes
Jun 25, 2025
Merged

feat(occ): Add commands to list all routes and match a single one#53669
nickvergessen merged 1 commit into
masterfrom
feat/noid/add-command-to-list-all-routes

Conversation

@nickvergessen

Copy link
Copy Markdown
Member

Match a route

  • -v for path and requirements of parameters
  • --method to specify HTTP method
$ occ router:match '/ocs/v2.php/apps/activity/api/v2/activity/{filter}' +------------------------------+----------+-----------------+-----------+
| route | appid | controller | method |
+------------------------------+----------+-----------------+-----------+
| ocs.activity.apiv2.getfilter | activity | APIv2Controller | getFilter |
+------------------------------+----------+-----------------+-----------+
$ occ router:match '/ocs/v2.php/apps/activity/api/v2/remote/1234567890' -v --method POST
+---------------------------------------------+----------+--------------------------+-----------------+-------------------------------------------------+--------------+
| route | appid | controller | method | path | requirements |
+---------------------------------------------+----------+--------------------------+-----------------+-------------------------------------------------+--------------+
| ocs.activity.remoteactivity.receiveactivity | activity | RemoteActivityController | receiveActivity | /ocs/v2.php/apps/activity/api/v2/remote/{token} | [] |
+---------------------------------------------+----------+--------------------------+-----------------+-------------------------------------------------+--------------+

List all routes (of apps)

  • -v for requirements of parameters
  • --ocs to only list OCS routes
  • --index to only list index.php routes
  • Optional argument list of apps
$ occ router:list notifications -v
+-----------------------------------------------+---------+-------------------------------------------------------------------------------+--------------------------------------+
| route | request | path | requirements |
+-----------------------------------------------+---------+-------------------------------------------------------------------------------+--------------------------------------+
| notifications.api.generatenotification | POST | /ocs/v2.php/apps/notifications/api/{apiVersion}/admin_notifications/{userId} | {"apiVersion":"(v1|v2)"} |
| notifications.api.generatenotificationv3 | POST | /ocs/v2.php/apps/notifications/api/{apiVersion3}/admin_notifications/{userId} | {"apiVersion3":"(v3)"} |
| notifications.api.selftestpush | POST | /ocs/v2.php/apps/notifications/api/{apiVersion3}/test/self | {"apiVersion3":"(v3)"} |
| notifications.endpoint.confirmidsforuser | POST | /ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/exists | {"apiVersion":"(v1|v2)"} |
| notifications.endpoint.deleteallnotifications | DELETE | /ocs/v2.php/apps/notifications/api/{apiVersion}/notifications | {"apiVersion":"(v1|v2)"} |
| notifications.endpoint.deletenotification | DELETE | /ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id} | {"apiVersion":"(v1|v2)","id":"\\d+"} |
| notifications.endpoint.getnotification | GET | /ocs/v2.php/apps/notifications/api/{apiVersion}/notifications/{id} | {"apiVersion":"(v1|v2)","id":"\\d+"} |
| notifications.endpoint.listnotifications | GET | /ocs/v2.php/apps/notifications/api/{apiVersion}/notifications | {"apiVersion":"(v1|v2)"} |
| notifications.push.registerdevice | POST | /ocs/v2.php/apps/notifications/api/{apiVersion}/push | {"apiVersion":"(v2)"} |
| notifications.push.removedevice | DELETE | /ocs/v2.php/apps/notifications/api/{apiVersion}/push | {"apiVersion":"(v2)"} |
| notifications.settings.admin | POST | /ocs/v2.php/apps/notifications/api/{apiVersion}/settings/admin | {"apiVersion":"(v2)"} |
| notifications.settings.personal | POST | /ocs/v2.php/apps/notifications/api/{apiVersion}/settings | {"apiVersion":"(v2)"} |
+-----------------------------------------------+---------+-------------------------------------------------------------------------------+--------------------------------------+
$ occ router:list activity
+-----------------------------------------+---------+----------------------------------------------------+
| route | request | path |
+-----------------------------------------+---------+----------------------------------------------------+
| activity.activities.index | GET | /apps/activity/ |
| activity.activities.showlist | GET | /apps/activity/{filter} |
| activity.apiv1.get | GET | /ocs/v2.php/cloud/activity |
| activity.apiv2.getdefault | GET | /ocs/v2.php/apps/activity/api/v2/activity |
| activity.apiv2.getfilter | GET | /ocs/v2.php/apps/activity/api/v2/activity/{filter} |
| activity.apiv2.listfilters | GET | /ocs/v2.php/apps/activity/api/v2/activity/filters |
| activity.feed.show | GET | /apps/activity/rss.php |
| activity.remoteactivity.receiveactivity | POST | /ocs/v2.php/apps/activity/api/v2/remote/{token} |
| activity.settings.admin | POST | /apps/activity/settings/admin |
| activity.settings.feed | POST | /apps/activity/settings/feed |
| activity.settings.personal | POST | /apps/activity/settings |
+-----------------------------------------+---------+----------------------------------------------------+
$ occ router:list activity --ocs
+-----------------------------------------+---------+----------------------------------------------------+
| route | request | path |
+-----------------------------------------+---------+----------------------------------------------------+
| activity.apiv1.get | GET | /ocs/v2.php/cloud/activity |
| activity.apiv2.getdefault | GET | /ocs/v2.php/apps/activity/api/v2/activity |
| activity.apiv2.getfilter | GET | /ocs/v2.php/apps/activity/api/v2/activity/{filter} |
| activity.apiv2.listfilters | GET | /ocs/v2.php/apps/activity/api/v2/activity/filters |
| activity.remoteactivity.receiveactivity | POST | /ocs/v2.php/apps/activity/api/v2/remote/{token} |
+-----------------------------------------+---------+----------------------------------------------------+
$ occ router:list activity --index
+------------------------------+---------+-------------------------------+
| route | request | path |
+------------------------------+---------+-------------------------------+
| activity.activities.index | GET | /apps/activity/ |
| activity.activities.showlist | GET | /apps/activity/{filter} |
| activity.feed.show | GET | /apps/activity/rss.php |
| activity.settings.admin | POST | /apps/activity/settings/admin |
| activity.settings.feed | POST | /apps/activity/settings/feed |
| activity.settings.personal | POST | /apps/activity/settings |
+------------------------------+---------+-------------------------------+

Checklist

@nickvergessennickvergessen added this to the Nextcloud 32 milestone Jun 24, 2025
@nickvergessennickvergessen self-assigned this Jun 24, 2025
@nickvergessen
nickvergessen requested a review from a team as a code ownerJune 24, 2025 21:46
@nickvergessen
nickvergessen requested review from artonge, come-nc and leftybournes and removed request for a teamJune 24, 2025 21:46
@nickvergessen
nickvergessen requested review from a team and provokateurinJune 24, 2025 21:46
@nickvergessen
nickvergessenforce-pushed the feat/noid/add-command-to-list-all-routes branch from df45317 to cd52d1bCompareJune 24, 2025 21:51
Comment threadcore/Command/Router/MatchRoute.php Outdated
Comment threadcore/Command/Router/MatchRoute.php
Comment threadcore/Command/Router/ListRoutes.php
Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen
nickvergessenforce-pushed the feat/noid/add-command-to-list-all-routes branch from cd52d1b to a957e3aCompareJune 25, 2025 06:20
@nickvergessennickvergessen added the pending documentation This pull request needs an associated documentation update label Jun 25, 2025
@nickvergessen
nickvergessen merged commit 06ebbb6 into masterJun 25, 2025
@nickvergessen
nickvergessen deleted the feat/noid/add-command-to-list-all-routes branch June 25, 2025 07:34
@nickvergessen

Copy link
Copy Markdown
MemberAuthor

/backport to stable31

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsenhancementpending documentationThis pull request needs an associated documentation updatetechnical debt🧱 🤔🚀

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@nickvergessen@AndyScherzinger@provokateurin@tobiasKaminsky@skjnldsv