marello icon indicating copy to clipboard operation
marello copied to clipboard

Validation error when creating product with prices via API

Open pkraeutli opened this issue 9 years ago • 1 comments

The request to POST /api/rest/v1/products with body:

{
  "id": null,
  "name": "Test",
  "sku": "123",
  "desiredStockLevel": 0,
  "purchaseStockLevel": 0,
  "replenishment": "end_of_life",
  "status": null,
  "createdAt": null,
  "updatedAt": null,
  "prices": [{
    "currency": "CHF",
    "value": "100.0000"
  }],
  "inventoryItems": [],
  "channels": []
}

results in 400 Bad Request:

{
  "code": 400,
  "message": "Validation Failed",
  "errors": {
    "children": {
      "replenishment": {},
      "name": {},
      "sku": {},
      "status": {},
      "weight": {},
      "desiredStockLevel": {},
      "purchaseStockLevel": {},
      "prices": {
        "errors": ["This value is not valid."]
      },
      "channels": {},
      "inventoryItems": {}
    }
  }
}

pkraeutli avatar Aug 25 '17 11:08 pkraeutli

Hi @pkraeutli,

Thanks for reporting. I will investigate further on the issue with prices validation. I'll keep you posted on any results I might find.

Kind Regards,

Jaimy Casteleijn

24198 avatar Aug 28 '17 11:08 24198