1

I am trying to update the quantity of products using the rest api call: {HostUrl}/rest/default/V1/inventory/source-items with the below data:

{
  "sourceItems": [
    {
      "sku": "EXAMPLE_SKU",
      "quantity": 4,
      "status": 1
    }
  ]
}

However, this is returning a 404 response saying that the route cannot be found. The route appears to be correct according to the Magento 2.4 static api documentation.

Other routes such as {HostUrl}/rest/V1/store/storeViews work without a problem and the permissions for modifying products/inventory have been given, so I'm at a dead end to understanding why this isn't working.

Any solution or advice will be massively appreciated :)

4
  • Do you have permission to the Magento_InventoryApi::source resource?
    – Jimmy
    Apr 14, 2021 at 2:00
  • Ever figure this out?
    – That1Guy
    Oct 21, 2021 at 15:16
  • @That1Guy I found out that the bulk API was only added in Magento 2.4, found out that the client wasn't actually using 2.4. So make sure you are using the right version. Also, just a heads up, you require some extensions to be installed for it to work, although I cannot remember what ones are required anymore. Oct 22, 2021 at 16:39
  • Thanks, @ZakDowsett - I appreciate the response. I'll keep that in mind.
    – That1Guy
    Oct 28, 2021 at 15:00

3 Answers 3

0

Remove default from the url {HostUrl}/rest/default/V1/inventory/source-items.

3
  • Hi Rahul, thanks for the suggestion. Unfortunately, this did not work. Apr 8, 2021 at 9:57
  • Have you checked with this url {HostUrl}/rest/V1/inventory/source-items ? Apr 8, 2021 at 11:16
  • Hi Rahul, yes I tried that. I got the same 404 response. Apr 8, 2021 at 13:52
0

as per the devdocs, https://developer.adobe.com/commerce/webapi/rest/inventory/manage-source-items/#assign-products-to-a-source

the source_code param is also needed, regardless of if you're using multiple sources. you can get a list of all sources with /rest/V1/inventory/sources

example:

{
  "sourceItems": [{
    "sku": "myproduct",
    "source_code": "home_source",
    "quantity": "521",
    "status": 1
  }]
}
0

Check if the following module is present and enabled in your app/etc/config.php

  • Magento_InventoryApi

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.