magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.39k stars 9.29k forks source link

Getting a full list of customerGroups with searchCriteria #16910

Open dwaynebartels opened 6 years ago

dwaynebartels commented 6 years ago

Endpoints like customerGroup/search need searchCriteria to get a full list of items. What we did in Magento 2.1.X is adding V1/customerGroups/search/?searchCriteria to get a list. but since 2.2.4 this doesn't work anymore and we found different solutions to the problem. One of them is sending invalid searchCriteria like V1/customerGroups/search/?searchCriteria=[] OR a question mark V1/customerGroups/search/?searchCriteria=? OR whatever. The API doesn't care and gives you a full list unless the searchCriteria is VALID. So I Imagine that when we fix our problem by sending invalid searchCriteria to get a List, things might change for the better in a later version of Magento and we have to FIX it again.. Which brings me to my Point.

When we want to get a List of something without providing searchCriteria.

Preconditions

  1. Magento 2.2.4
  2. Postman

Steps to reproduce

  1. Use V1/customerGroups/search/?searchCriteria to get a list (worked in 2.2.3 and before)
  2. Get a Fatal Error:
    {
    "messages": {
        "error": [
            {
                "code": 500,
                "message": "Fatal Error: 'Uncaught TypeError: Argument 1 passed to Magento\\Customer\\Model\\ResourceModel\\GroupRepository\\Interceptor::getList() must be an instance of Magento\\Framework\\Api\\SearchCriteriaInterface, string given in /home/xxxxxxxxxxxxxxxx/generated/code/Magento/Customer/Model/ResourceModel/GroupRepository/Interceptor.php:46\nStack trace:\n#0 [internal function]: Magento\\Customer\\Model\\ResourceModel\\GroupRepository\\Interceptor->getList('')\n#1 /home/xxxxxxxxx/vendor/magento/module-webapi/Controller/Rest.php(330): call_user_func_array(Array, Array)\n#2 /home/xxxxxxxxxxxxxxxxx/vendor/magento/module-webapi/Controller/Rest.php(239): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#3 /home/xxxxxxxxxxxxx/vendor/magento/framework/Interception/Interceptor.php(58): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#4 /home/xxxxxxxxxxxxx/vendor/magento/framework/Interception/Interceptor.php(138): Magent' in '/home/xxxxxxxxxxxxxxxxxx/generated/code/Magento/Customer/Model/ResourceModel/GroupRepository/Interceptor.php' on line 46",
                "trace": "Trace is not available."
            }
        ]
    }
    }
  3. Use V1/customerGroups/search/?searchCriteria={whatever it doesn't matter} to get a list
  4. Get a full list with customerGroups

Expected result

  1. A full list or at least a decent error message.

Actual result

  1. 500 Fatal Error
magento-engcom-team commented 6 years ago

Hi @dwaynebartels. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me {$VERSION} instance

where {$VERSION} is version tags (starting from 2.2.0+) or develop branches (2.2-develop +). For more details, please, review the Magento Contributor Assistant documentation.

@dwaynebartels do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

dwaynebartels commented 6 years ago

@magento-engcom-team yes

engcom-backlog-nickolas commented 6 years ago

Hello @dwaynebartels, thank you for your report. We've acknowledged the issue and added to our backlog.

magento-engcom-team commented 5 years ago

Hi @eduard13. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

dwaynebartels commented 5 years ago

Please do not close this issue because of inactivity. We want to see this fixed.

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1019 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.