HTTP 200 or 404 for empty list?

前端 未结 4 1666
旧巷少年郎
旧巷少年郎 2021-02-13 12:30

I know this is a fairly common question, but I haven\'t found an answer that satisfies me.

I\'ve been using django rest framework for a while now, but this is mostly irr

4条回答
  •  一向
    一向 (楼主)
    2021-02-13 13:29

    I would go for 200 because the resource is articles. While querying for ted in users the same applies, users is the resource and as long it is there, a 200 is okay from my point of view. If you would GET users/ted a 404 would be as good as a 410 (GONE) if a user named ted was there in the past (may better applies to articles than users).

提交回复
热议问题