Skip to content

Rest API get stock_items with low stock not behaving like other get methods #8211

@NotAndD

Description

@NotAndD

Preconditions

  1. Install Magento 2.1.3 with sample data.
  2. Set up Rest integration.

Steps to reproduce

  1. Retrieve stock_item list of low stock items sending a Rest request to /V1/stockItems/lowStock/ with method GET, query parameters scope_id and qty as specified in the documentation. Rest request like this: rest/default/V1/stockItems/lowStock/?scopeId=0&qty=10.

Expected result

  1. As for all other Rest methods available that returns a list taking filter parameters and as the documentation specify, if no page_size is given, all results of the query should be returned.

Actual result

  1. Only one stock item is returned, in addition, search_criteria has a different structure from other methods, with a limit field that is automatically set like this:
"limit": [
      "1",
      "0"
    ]

Notes

Either changing the documentation (fast solution) or even better, uniforming this method with all the other available methods, making it accept a filter and not only page filter parameters (page_size and current_page).

Additional info

  • Reproducible on Magento 2.4-develop
  • The way it can be reproduced via Swagger
  1. In your web browser open http://{magento2 instanse}/swagger#/integrationAdminTokenServiceV1/integrationAdminTokenServiceV1CreateAdminAccessTokenPost click Try it out
    try_it_out
  2. Set admin User name and Passwod and click Execute
  3. Copy the token from the Response body
    token
    and Paste it into api_key field in the top right corner. Click Apply
    api_key
  4. Open catalogInventoryStockRegistryV1 - GET /V1/stockItemslowStock clcik Try in out
    low stock_catalog
  5. Set scopeId to 0 qty to 10. Click Execute
    scope_qty

Actual Result:
limit

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: Framework/WebapiUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: doneReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itbug report

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions