0

I get this error:

[2022-03-24 11:32:10] main.CRITICAL: Report ID: webapi-623c56baea1fe; Message: Property "Qty" does not have accessor method "getQty" in class "Magento\InventoryApi\Api\Data\SourceItemInterface". {"exception":"[object] (Exception(code: 0): Report ID: webapi-623c56baea1fe; Message: Property "Qty" does not have accessor method "getQty" in class "Magento\InventoryApi\Api\Data\SourceItemInterface". at /domains/dev.vapestore.co.uk/http/vendor/magento/framework/Webapi/ErrorProcessor.php:208, LogicException(code: 0): Property "Qty" does not have accessor method "getQty" in class "Magento\InventoryApi\Api\Data\SourceItemInterface". at /domains/dev.vapestore.co.uk/http/vendor/magento/framework/Reflection/NameFinder.php:100)"} []

When trying to update the stock qty of a product via API.

The request using Postman:

POST: /index.php/rest/all/V1/inventory/source-items
body: 
{
  "sourceItems": [{
    "sku": "PE-GR-03",
    "source_code": "02",
    "qty": 5,
    "status": 1
  }]
}

1 Answer 1

0

I found the problem...

The property name for quantity should be "quantity" not "qty".

That works:

POST: /index.php/rest/all/V1/inventory/source-items
body: 
{
  "sourceItems": [{
    "sku": "PE-GR-03",
    "source_code": "02",
    "quantity": 5,
    "status": 1
  }]
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.