Skip to content

Validation error when creating product with prices via API #25

@pkraeutli

Description

@pkraeutli

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": {}
    }
  }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions