大家好,我们正在使用 php curl 向 orocommerce 发送补丁请求:
网址:网址http://oro.demo/commerce/public/admin/api/products/71
数据为:
{"data":{"type":"products","id":"70","attributes":{"sku":"10305","status":"enabled","variantFields":[], "productType":"simple","featured":true,"newArrival":false},"relationships":{"attributeFamily":{"data":{"type":"attributefamilies","id":"1 "}},"inventory_status":{"data":{"type":"prodinventorystatuses","id":"in_stock"}},"names":{"data":[{"type":"localizedfallbackvalues" ,"id":"names-1"}]},"primaryUnitPrecision":{"data":{"type":"productunitprecisions","id":"product-unit-precision-id-3"}}}},"included":[{"type":"productunitprecisions","id":"product-unit-precision-id-3","attributes":{ "precision":"7","conversionRate":"5","sell":"0"},"relationships":{"unit":{"data":{"type":"productunits","id ":"set"}}}},{"type":"localizedfallbackvalues","id":"names-1","attributes":{"fallback":null,"string":"Fruit Oatmeal"," text":null},"relationships":{"localization":{"data":null}}}]}product-unit-precision-id-3","attributes":{"precision":"7","conversionRate":"5","sell":"0"},"relationships":{"unit": {"data":{"type":"productunits","id":"set"}}}},{"type":"localizedfallbackvalues","id":"names-1","attributes":{ "fallback":null,"string":"Fruit Oatmeal","text":null},"relationships":{"localization":{"data":null}}}]}product-unit-precision-id-3","attributes":{"precision":"7","conversionRate":"5","sell":"0"},"relationships":{"unit": {"data":{"type":"productunits","id":"set"}}}},{"type":"localizedfallbackvalues","id":"names-1","attributes":{ "fallback":null,"string":"Fruit Oatmeal","text":null},"relationships":{"localization":{"data":null}}}]}"id":"set"}}}},{"type":"localizedfallbackvalues","id":"names-1","attributes":{"fallback":null,"string":"Fruit Oatmeal" ,"text":null},"relationships":{"localization":{"data":null}}}]}"id":"set"}}}},{"type":"localizedfallbackvalues","id":"names-1","attributes":{"fallback":null,"string":"Fruit Oatmeal" ,"text":null},"relationships":{"localization":{"data":null}}}]}
作为响应,我们得到了结果错误。
[{"title":"extra fields constraint","detail":"此表单不应包含额外字段:"{"data":{"type":"products","id":"70","attributes ":{"sku":"10305","status":"enabled","variantFields":"."}]