php – Shopeware 6 unable to add product with APIs-ThrowExceptions

Exception or error:

I am working with shopeware 6 and adding the data with APIs. Using their documentation i have implemented the APIs for adding categories. Because they have given it in the docs. For more API info they asked to open swagger link.

So i tried it. But in the swagger there is no proper explanation of APIs. Somehow i manage to implement manufacturer API. But Now not able to implement add product APIs.

Please help me and let me know the required fields for the add product apis. I have tried API with some data but got error.

URL- https://www.meptrade.co.uk/api/v1/product Type – POST {
“stock”:1000, “taxId”:”f6ac5dsvjbd7wd3b2i32bb89e2e802fc1a1e”,
“price”:”100″, “name”:”test”,
“manufacturerId”:”72f26544ddfbb55eb3bwbt348ec0ea717″ }

Error:-

{“errors”:[{“code”:”c1051bb4-d103-4f74-8988-acbcafc7fdc3″,”status”:”400″,”detail”:”This
value should not be blank.”,”template”:”This value should not be
blank.”,”meta”:{“parameters”:{“{{ value
}}”:”null”}},”source”:{“pointer”:”/0/productNumber”}}]}

How to solve:

The error says you are missing a required field, which in this case is the productNumber. A product needs several required fields. You can look them up in the ProductDefinition (they have the Required flag)
You need at least:

  • name
  • manufacturer
  • productNumber
  • tax
  • price
  • stock

You could also have a look at the product api test which creates a product in its tests.

Leave a Reply

Your email address will not be published. Required fields are marked *