Shopware Admin API请求体传参失败问题咨询
Solution for Shopware Admin API Body Parameters
- The validation errors occur because
POST /api/orderis designed for creating new orders, not fetching existing ones. Shopware expects order creation data (like billing address, currency ID) here, hence the missing required fields error. - To fetch orders with filter/limit parameters in the request body, use Shopware's dedicated search endpoint:
POST /api/search/order - Wrap your query parameters inside a
criteriaobject in the request body. Here's a corrected request example:
POST /api/search/order HTTP/1.1 Authorization: Bearer XXXXX Host: 127.0.0.1:8000 Content-Type: application/json Content-Length: 35 { "criteria": { "limit": 2 } }
- You can extend the
criteriaobject with additional parameters like filters, sorting, or associations as needed. For example, to filter orders by status:
{ "criteria": { "limit": 2, "filter": [ { "type": "equals", "field": "stateMachineState.technicalName", "value": "completed" } ] } }
内容的提问来源于stack exchange,提问作者O'Niel
相关产品推荐
相关产品推荐

