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

前端 未结 13 1945
花落未央
花落未央 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:19

    While the response to /API/users is paged and returns only 30, records, there's nothing preventing you from including in the response also the total number of records, and other relevant info, like the page size, the page number/offset, etc.

    The StackOverflow API is a good example of that same design. Here's the documentation for the Users method - https://api.stackexchange.com/docs/users

提交回复
热议问题