Using Magento 2.2.2, I was trying to add stock updates to a pre-existing setup using the official defined endpoint:

    rest/V1/products/testsku/stockItems/1

with

    { 
      "stock_item": {
        "qty": 1234,
        "is_in_stock": true
      }
    }

which wouldn't work.  Searching around, I found an example [here][1] which essentially strips the product create/update JSON right back to the bare minimum and just include the stock data:

    rest/V1/products/testsku
.

    {
      "product": {
        "sku": "testsku",
        "extensionattributes": {
          "stockitem": {
            "qty": 1234,
            "isinstock": true,
          }
        }
      },
     "saveOptions": true
    }

I changed my stock update process to call this instead, and it works.

However, I noticed afterwards that the `extensionattributes` (and it's sub fields) is missing the underscore, according to the official swagger API documentation.  My product create call already includes the underscore fields when creating the item to set an initial stock quantity, yet don't seem to be working.

What's the difference - underscore or no underscore? Which is correct?  Is this a bug or an undocumented change, or are both field names valid?


  [1]: http://www.danjoseph.me/2016/06/17/magento-2-rest-api-part-3-product-updates-pricing-qty/