Getting a count of returns seen by a RESTful request

后端 未结 4 1146
温柔的废话
温柔的废话 2020-12-14 09:17

So, I\'d like to know how many results I\'ll be getting back from a RESTful uri GET request. I don\'t know of any way to do that at this point. Is there a way to do that?

4条回答
  •  悲&欢浪女
    2020-12-14 09:58

    Why don't you make your resource handle queries for that type of metadata? Suppose that

    GET /items
    

    returns your list of items like this:

    
      
      
      ...
    
    

    Then something like:

    GET /items?info
    

    could return an empty list like this:

    
    

    or possibly a generic info document like this:

    
      
    
    

    You could also implement an "info" resource like this:

    GET /info?items&users
    

    which might return:

    
      
      
    
    

提交回复
热议问题