rest - What is the correct HTTP status code for search results not found?
问题描述
We are implementing REST APIs in Java.
For GET REST endpoint, if I search for something:
If any records/record found, then it will return 200 status code and results/result.
If NO records found, what is the correct HTTP status code ?
When I searched in Google and SO, I found different answers like:
200 with empty list (if the API response is item but NOT list, then I can't send empty list)
204 No Content
404 Not Found
what is the correct HTTP status code if record not found or search results not found ?
解决方案
推荐阅读
- angular - Angular 5 内容上传 GZip
- c# - 在 UWP C# 中从图像中获取主色
- javascript - 不能使用 DOM 节点的属性作为 XPath / CSS 选择器查询的过滤器
- laravel-5.6 - 如何在 laravel 中创建 Echo
- tensorflow - TensorFlow Estimators 和大量预训练模型:跨调用重用?
- mysql - 如何从表中选择特定数据?
- vbscript - 如果匹配条件,如何提取当前行内容?
- react-native - 反应本机 Firebase 身份验证返回未定义
- android-studio - android studio 调色板在我的 activity.xml 中不可见,而在我的 android 模拟器中可以看到
- html - Fileupload 控件总是返回 Hasfile 属性 false