What’s the best RESTful method to return total number of items in an object?

前端 未结 13 1931
花落未央
花落未央 2020-11-29 15:52

I’m developing a REST API service for a large social networking website I’m involved in. So far, it’s working great. I can issue GET, POST, P

13条回答
  •  一整个雨季
    2020-11-29 16:30

    Sometimes frameworks (like $resource/AngularJS) require an array as a query result, and you can't really have a response like {count:10,items:[...]} in this case I store "count" in responseHeaders.

    P. S. Actually you can do that with $resource/AngularJS, but it needs some tweaks.

提交回复
热议问题