?
avatar anibalsanchez
anibalsanchez
26 Apr 2021

Steps to reproduce the issue

The current endpoint to manage extensions /installer is based on com_installer. It publishes the /installer, the com_installer internal component, as a first-level entry-point of the REST API to manage extensions on Joomla 4.

This is not following REST practices and it differents from the other endpoints semantic, based on data entities or CMS concepts: https://docs.joomla.org/J4.x:Joomla_Core_APIs

  • /banners
  • /config
  • /contact
  • /content
  • /menus
  • /messages
  • /modules
  • /newsfeeds
  • /privacy
  • /redirect
  • /tags
  • /templates
  • /users

Additionally, the current /installer endpoint is being directly translated from the MVC into the rest API.

index.php?option=com_installer&view=manage is translated to /installer/manage?...

This is not following a good REST semantic Provide Sensible Resource Names (https://www.restapitutorial.com/lessons/restquicktips.html) and it is a direct translation of the current MVC internal implementation.

Expected result

It would be better to follow the semantic of the previous endpoints and change the endpoint to /extensions and align the actions to the expected meaningful actions.

For instance, to install an extension you should do a POST /api/index.php/v1/extensions/install. Extension as the Noun and Install as the Action.

Manage is not a good action since all actions of the extensions manager can be classified as management.

It would be clearer to have an API like this:

  • Index: GET /api/index.php/v1/extensions
  • Update: PUT /api/index.php/v1/extensions/{id}
  • Publish: POST /api/index.php/v1/extensions/{id}/publish

Actual result

The current REST API is based on the current UI.

System information (as much as possible)

Joomla 4 REST API

Additional comments

This issue started on #32769 and @wilsonge asked to discuss it separately.

avatar anibalsanchez anibalsanchez - open - 26 Apr 2021
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Apr 2021
avatar alikon
alikon - comment - 26 Apr 2021

@anibalsanchez
so an http://dev4.loc/api/index.php/v1/extensions/list
it's better than
http://dev4.loc/api/index.php/v1/installer/manage

?

avatar alikon
alikon - comment - 26 Apr 2021

see #33339

avatar anibalsanchez
anibalsanchez - comment - 26 Apr 2021

Hi, Thanks @alikon for the PR.

/list is not needed as an endpoint. Check that there is no similar /list noun in the current API: https://docs.joomla.org/J4.x:Joomla_Core_APIs

A list can be provided simply with GET /api/index.php/v1/extensions

avatar alikon alikon - change - 26 Apr 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-04-26 17:29:31
Closed_By alikon
avatar alikon alikon - close - 26 Apr 2021
avatar alikon
alikon - comment - 26 Apr 2021

please test #33339

Add a Comment

Login with GitHub to post a comment