Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 409381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:47:05+00:00 2026-05-12T17:47:05+00:00

So, I’d like to know how many results I’ll be getting back from a

  • 0

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? Since REST just throws out properties, I don’t know if it is able to take a count of its results, but it can skip results and take a subset of results.

Anybody have any suggestions?

Oh my setup is a LINQ to SQL that populates a queriable generic List. The data service makes that list available. I’ve tried getting a count on the list, but I always get the max rows of the database back, and that isn’t what I’m looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:47:05+00:00Added an answer on May 12, 2026 at 5:47 pm

    Other people might have objections to this concept, but, this seems reasonable to me:

    HEAD /your/api HTTP/1.1
    
    HTTP/1.1 200 OK
    Date: Fri, 23 Oct 2009 00:58:17 GMT
    Content-Type: application/xml; charset=UTF-8
    Content-Length: 89
    X-Result-Count: 100000000
    

    And then:

    GET /your/api HTTP/1.1
    
    HTTP/1.1 200 OK
    Date: Fri, 23 Oct 2009 00:58:17 GMT
    Content-Type: application/xml; charset=UTF-8
    Content-Length: 89
    X-Result-Count: 100000000
    
    <?xml version="1.0" encoding="UTF-8"?>
    <results>
      100000000 results go here.
    </results>
    

    Note: A HEAD request is used here to obtain the count without having to pull the full data set. HEAD requests retrieve only the HTTP headers, not the body of the response.

    This would be the most RESTful way I can think of indicating how many results you’re gonna get back before you send it over the wire. The main trick is just coming up with the best header name for it. X-Result-Count is decent, but if you can find prior art and reuse their header name choice, that would be even better (as long as they didn’t name it something really dumb). That said, I don’t expect you’ll have much luck, so you should probably stick with X-Result-Count.

    Also, I think you may have misunderstood what “REST” actually entails. There’s no reason you can’t give a representation by range. For example:

    GET /your/api?page=1&perpage=10 HTTP/1.1
    
    HTTP/1.1 200 OK
    Date: Fri, 23 Oct 2009 00:58:17 GMT
    Content-Type: application/xml; charset=UTF-8
    Content-Length: 101
    X-Result-Count: 10
    
    <?xml version="1.0" encoding="UTF-8"?>
    <results>
      First 10 results of 100000000 go here.
    </results>
    

    However, to be RESTful, you need to be able to tell the client about the representation identified by /your/api?range=0-9 or /your/api?page=1&perpage=10 without using out-of-band information. For example, if your /your/api page would return too many results, do a temporary redirect to /your/api?page=1&perpage=10, and include hyperlinks to /your/api?page=2&perpage=10. Note that a hyperlink in this context could be something simple like:

    <?xml version="1.0" encoding="UTF-8"?>
    <results>
      <result>
        This is a result.
      </result>
      <result>
        This is also a result.
      </result>
      <link rel="next" href="/your/api?page=3&perpage=2" />
      <link rel="prev" href="/your/api?page=1&perpage=2" />
    </results>
    

    Now the information to navigate the results of your API calls is in-band and actually RESTful.

    Essentially, REST is plain-old-HTTP with caching done right and usually sensible URIs thrown in for good measure. It’s also “hypertext as the engine of application state” (i.e. resources should link to other resources). It is not a protocol, it’s an architectural style. Anyone who tells you differently had better be named Roy Fielding.

    • http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post
    • http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
    • http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven#comment-718

    Addenda:

    If you want to indicate the total count versus the page count, you can define the header like so:

    X-Result-Count: 0-9/100000000
    

    Or adjust as necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 334k
  • Answers 334k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As the error says - it looks like you are… May 14, 2026 at 3:23 am
  • Editorial Team
    Editorial Team added an answer The trick here is that using the C++ API will… May 14, 2026 at 3:23 am
  • Editorial Team
    Editorial Team added an answer This will fail if you're running the development server, since… May 14, 2026 at 3:23 am

Related Questions

I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
this is what i have right now Drawing an RSS feed into the php,
I have text I am displaying in SIlverlight that is coming from a CMS
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.