[英]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.