2

I am doing an integration with our other systems where I am trying to create a simple product (for now) in Magento 2.0.0 (will update soon but in the middle of this) using a rest call. I have tried both post and put and both work but for some odd reason the price, weight and tax code I send are ignored. All three fields are present in the payload (triple checked). No error just ignored and all three are left empty.

Anyone know if there is something specific about these three fields? I haven't tried updating the product yet so I don't know if that works.

  • It appears that these values can then be set once the product has been created. Same goes for product attributes in general in seems. Which is strange since the description is an attribute and that is set from the start. – Patrik Lundgren Feb 10 '16 at 13:51
2

POST /V1/products should be used for product creation, while PUT /V1/products/:sku for product update. They both rely on the same service method \Magento\Catalog\Model\ProductRepository::save, but that may be your problem.

  • 1
    Yes I use post to create and put to update like you said. I have yet to notice a difference between the two by the way. Still quite a few fields seem to be ignored if the product is created by the call. All update ok next time (no matter which method is used). Now this isn't a huge issue. I just do two calls per product (since I only have a few hundred). I was just curious if anyone knew more about the logic behind it. – Patrik Lundgren Feb 11 '16 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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