简体   繁体   English

如何返回 Rest API 中的计数

[英]How to return count in Rest API

I'd like to return a count of some articles, how should the URL looks like?我想返回一些文章的计数,URL应该是怎样的? Does it make sense to be /api/articles/count ? /api/articles/count有意义吗? I do not have a resource to return articles and do not need to do that, I am interested only in the count.我没有返回文章的资源,也不需要这样做,我只对计数感兴趣。

Does it make sense to be /api/articles/count? /api/articles/count 有意义吗?

Sure it makes sense.当然这是有道理的。

Just to mention the URI structure does not matter that much if your api meets the HATEOAS constraint of REST.如果您的 api 满足 REST 的 HATEOAS 约束,仅提及 URI 结构并不重要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 JAVA 的 rest API 中将图像返回给浏览器? - How to return an Image to browser in rest API in JAVA? 如何返回 JSONObject 列表作为 REST API 响应 - How to return a list of JSONObject as REST API response 如何在使用Spring框架实现的REST API中返回以false形式呈现的JSON? - How to return the JSON with present as false in a REST API implemented with Spring framework? 如何在 Jackson 框架 rest api 中返回 JSONArray 的响应? - How to return response of JSONArray in Jackson framework rest api's? 如何让Java rest api调用立即返回不等? - How to make Java rest api call return immediately not wait? 当 spring REST api 中缺少 header 时如何返回响应正文 - how to return a response body when header is missing in spring REST api 如何使用Spring Boot应用程序从Rest API返回HTML - How to return html from Rest API with spring boot application 如何在rest api中使用hashmap返回多值参数 - How to use hashmap to return multi valued parameter in rest api 如何返回N1qlQueryResult作为Couchbase数据库的REST API的响应? - How to return N1qlQueryResult as the response of REST API for Couchbase databse? 如何使Java Rest API返回多个JSON对象 - How to make java rest api return multiple json objects
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM