我使用沒有 ORM 的 api-platform。這是我的第三個 API。其他 2 個通過 Doctrine 鏈接到資料庫。這個用于鏈接其他兩個,因此不需要資料庫。
我不能對 GET 請求使用搜索過濾器,因為我有錯誤:
Call to a member function getClassMetadata() on null
(因為我沒有用 ORM 映射物件......)
所以我使用 POST 請求,給我一個 201 HTTP 回傳碼。
我可以得到 200 而不是這個 201(以滿足 CORS ......)?
uj5u.com熱心網友回復:
在 APIP 中,您可以通過在 POST 操作中添加關鍵狀態來更改任何操作狀態,更多詳細資訊請點擊此處https://api-platform.com/docs/core/operations/#configuring-operations
#[ApiResource(
collectionOperations: [
'post' => [
'path' => '/grimoire',
'status' => 301,
],
],
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/376635.html
標籤:php symfony http 奥姆 api-platform.com
