2017-08-26 6 views
0

私は204(No Content)を使用して、サーバーがフォルダの削除要求を実行したことを示し、404はフォルダが見つからない場合を示します。 DELETE動詞が空でないフォルダーに対して発行された場合、エラーを出したいと思います。この状況に適したHTTP応答ステータスコードは何でしょうか?空でないリソースを削除するための適切なHTTPエラー

答えて

0

私は正しいものが409コンフリクトであると信じています。

The request could not be completed due to a conflict with the current state of 
the resource. This code is only allowed in situations where it is expected 
that the user might be able to resolve the conflict and resubmit the request. 
The response body SHOULD include enough information for the user to recognize 
the source of the conflict. Ideally, the response entity would include enough 
information for the user or user agent to fix the problem; however, that might 
not be possible and is not required. 

http://www.restapitutorial.com/httpstatuscodes.htmlは、リソースの競合が要求を満たすことに起因する時はいつでも409を使用すべきであると言います。 cascade-deleteがサポートされていない場合、エントリの重複とルートオブジェクトの削除はいくつかの例です。

+0

ありがとうございました。私は、Azure StorageとOpenStack Swift Rest APIのリファレンスを見ていました。両方とも、これに対して409 Conflictを採用したようです。 –

関連する問題