在使用 Shopware 6 的產品 API 進行一些測驗后,我收到 500 錯誤,顯示“無法取消設定偏移量字串”。
這些資訊對我來說還不夠,要除錯它,因為我對 Shopware 6 API 有點陌生。
這是錯誤:
{
"errors": [{
"code": "0",
"status": "500",
"title": "Internal Server Error",
"detail": "Cannot unset string offsets"
}]
}
我正在使用這個網站:https ://reqbin.com/
我通過 POST 請求呼叫 URL:https : //www.my-url.de/api/product。
作為授權,我使用從 getToken GET-Request 中獲取的不記名令牌。
我的請求內容如下所示:
{
"productId":"fd1be1ea-884a-4049-b143-605d8dfaa589",
"parentId":"fd1be1ea-884a-4049-b143-605d8dfaa589",
"name":"Sorelie",
"taxId":"f68a9c3c-8686-4c2e-a759-7062fc457cf7",
"productNumber":"16345583549",
"minPurchase":"1",
"purchasePrice":"0",
"price":{
"currencyId":"b7d2554b-0ce8-47cd-82f3-ac9bd1c0dfca",
"net":"0",
"gross":"0"
},
"stock":"0",
"images":"",
"atributes":"",
"categoryId":"29"
}
我從現有資料庫中復制粘貼 taxId 和 currencyId 并將其格式化為與我手動生成的 productId 和 parentId 相同的格式。
uj5u.com熱心網友回復:
我認為你有兩個問題:
- price 欄位應該是一個物件陣列,例如
"price":[{
"currencyId":"b7d2554b-0ce8-47cd-82f3-ac9bd1c0dfca",
"net":"0",
"gross":"0"
}],
- 您需要從所有 id 欄位中洗掉破折號,例如 fd1be1ea-884a-4049-b143-605d8dfaa589 => fd1be1ea884a4049b143605d8dfaa589
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/325930.html
下一篇:為什么在部署到Heroku時會收到“NameError:uninitializedconstantDotenv”?
