? Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
21 Mar 2021

Summary of Changes

add filtering of data

Testing Instructions

  • GET {{base_path}}/api/index.php/v1/installer/manage?core=true/false
  • GET {{base_path}}/api/index.php/v1/installer/manage?status=0/1
  • GET {{base_path}}/api/index.php/v1/installer/manage?type=component/plugin/module/template

Actual result BEFORE applying this Pull Request

N/A

Expected result AFTER applying this Pull Request

{
    "links": {
        "self": "https://demo4.loc/api/index.php/v1/installer/manage?core=0"
    },
    "data": [
        {
            "type": "manage",
            "id": "224",
            "attributes": {
                "name": "Action Log - Akeeba Backup",
                "type": "plugin",
                "folder": "actionlog",
                "client_id": "0",
                "status": "0",
                "version": "8.0.1",
                "id": "224"
            }
        },
        {
            "type": "manage",
            "id": "220",
            "attributes": {
                "name": "Akeeba Backup",
                "type": "component",
                "folder": "",
                "client_id": "1",
                "status": "1",
                "version": "8.0.1",
                "id": "220"
            }
        },
        {
            "type": "manage",
            "id": "225",
            "attributes": {
                "name": "Akeeba Backup package",
                "type": "package",
                "folder": "",
                "client_id": "0",
                "status": "1",
                "version": "8.0.1",
                "id": "225"
            }
        },
        {
            "type": "manage",
            "id": "221",
            "attributes": {
                "name": "Console - Akeeba Backup",
                "type": "plugin",
                "folder": "console",
                "client_id": "0",
                "status": "1",
                "version": "8.0.1",
                "id": "221"
            }
        },
        {
            "type": "manage",
            "id": "226",
            "attributes": {
                "name": "file_fef",
                "type": "file",
                "folder": "",
                "client_id": "0",
                "status": "1",
                "version": "2.0.1",
                "id": "226"
            }
        },
        {
            "type": "manage",
            "id": "219",
            "attributes": {
                "name": "file_fof40",
                "type": "file",
                "folder": "",
                "client_id": "0",
                "status": "1",
                "version": "4.0.2",
                "id": "219"
            }
        },
        {
            "type": "manage",
            "id": "218",
            "attributes": {
                "name": "Joomla! Patch Tester",
                "type": "component",
                "folder": "",
                "client_id": "1",
                "status": "1",
                "version": "4.0.1",
                "id": "218"
            }
        },
        {
            "type": "manage",
            "id": "222",
            "attributes": {
                "name": "Quick Icon - Akeeba Backup Notification",
                "type": "plugin",
                "folder": "quickicon",
                "client_id": "0",
                "status": "1",
                "version": "8.0.1",
                "id": "222"
            }
        },
        {
            "type": "manage",
            "id": "217",
            "attributes": {
                "name": "Sample Data - Testing",
                "type": "plugin",
                "folder": "sampledata",
                "client_id": "0",
                "status": "0",
                "version": "4.0.0",
                "id": "217"
            }
        },
        {
            "type": "manage",
            "id": "223",
            "attributes": {
                "name": "System - Backup on update",
                "type": "plugin",
                "folder": "system",
                "client_id": "0",
                "status": "0",
                "version": "8.0.1",
                "id": "223"
            }
        }
    ],
    "meta": {
        "total-pages": 1
    }
}

Documentation Changes Required

avatar alikon alikon - open - 21 Mar 2021
avatar alikon alikon - change - 21 Mar 2021
Status New Pending
avatar alikon alikon - change - 22 Mar 2021
Labels Added: ?
af83376 23 Mar 2021 avatar alikon Bool
avatar alikon alikon - change - 23 Mar 2021
The description was changed
avatar alikon alikon - edited - 23 Mar 2021
avatar Quy
Quy - comment - 25 Mar 2021

For core, should all entries be displayed if true/false is not entered?

avatar alikon
alikon - comment - 25 Mar 2021

when core is omitted it works like before ie all items are returned

avatar Quy
Quy - comment - 25 Mar 2021

core=0 returns entries. Should it?

avatar alikon
alikon - comment - 27 Mar 2021

no
better a 400

{
    "errors": [
        {
            "title": "Invalid field: core",
            "code": 400
        }
    ]
}
271b92f 27 Mar 2021 avatar alikon $
avatar Quy
Quy - comment - 28 Mar 2021

It is not a consistent to show an error vs. the following.

In this example, a 2 is added at the end.

{
    "links": {
        "self": "http://localhost/joomla-cms-4.0-dev/api/index.php/v1/installer/manage?type=component2"
    },
    "data": [],
    "meta": {
        "total-pages": 0
    }
}
avatar alikon
alikon - comment - 29 Mar 2021

these are different things
it has been requested to manage core like boolean hence the check (invalid field)
but for type it's a string so 0 found it's a correct response

avatar anibalsanchez
anibalsanchez - comment - 23 Apr 2021

I think that the GET verb is wrong in the REST API controller Installer.

/installer is not a data entity. It is a controller/helper itself that provides the behaviour, actions.

It looks odd calling an action with a GET. /installer/manage is a method, so for clarity, it is better if it is called with a POST (even if it doesn't persist a change).

So, if everything that Installer does is managing, then the method manage must return different types of data based on a control parameter. If we follow the Joomla practice, it should have a task parameter to return data or persist changes.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32769.
avatar alikon
alikon - comment - 24 Apr 2021

beyond the scope of this pr

avatar anibalsanchez
anibalsanchez - comment - 24 Apr 2021

Thinking twice about the API for extensions, it is not right to publish the "Installer" /installer. It is not the right semantic.

Check the documentation https://docs.joomla.org/J4.x:Joomla_Core_APIs. The entry points are always entities.

It is better to manage the extensions as /api/index.php/v1/extensions/...

For instance, to install an extension you should do a POST /api/index.php/v1/extensions/install.

avatar wilsonge
wilsonge - comment - 25 Apr 2021

@anibalsanchez i agree with you - however Nicola is also correct that his pr is just adding filters to an existing endpoint - so can you create a separate issue to track your comment - and I'll try and work on it

avatar alikon
alikon - comment - 9 May 2021

merged in #33339

avatar alikon alikon - change - 9 May 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-05-09 07:37:29
Closed_By alikon
avatar alikon alikon - close - 9 May 2021

Add a Comment

Login with GitHub to post a comment