What's the right HTTP status code for a respon

2019-04-18 16:04发布

What would be the right response I should give to the users when they try to DELETE an entity on a datasource sitting behind a rest/odata api, and the operation cannot be performed due to a foreign key constrain? Is it a bad request? A not acceptable? A server-side error (>=500)?

1条回答
Melony?
2楼-- · 2019-04-18 16:31

Just found this website that says that '409 Conflict' should be used when 'the request could not be completed due to a conflict with the current state of the resource' and 'where it is expected that the user might be able to resolve the conflict and resubmit the request', then it gives an example when 'cascade-delete is not supported' which kinda resembles my scenario..

http://www.restapitutorial.com/httpstatuscodes.html

查看更多
登录 后发表回答