3

Is it my imagination (scratch that, it's definitely not), or does simply browsing method doc pages (without using the "Run" function) consume quota?

From Bash using httpie and jq (on a private, non-shared IP):

$ http "https://api.stackexchange.com/2.3/questions?fromdate=1648771200&order=asc&sort=creation&site=askubuntu&pagesize=100&page=1" | jq ".quota_remaining"
164
# Repeat again
$ http "https://api.stackexchange.com/2.3/questions?fromdate=1648771200&order=asc&sort=creation&site=askubuntu&pagesize=100&page=1" | jq ".quota_remaining"
163

Go browse the /answers method doc in the browser. Then /answers/{ids}.

Then, again:

$ http "https://api.stackexchange.com/2.3/questions?fromdate=1648771200&order=asc&sort=creation&site=askubuntu&pagesize=100&page=1" | jq ".quota_remaining"
154

Each doc (method) page hit seems to consume 4 quota units.

On the other hand, pages like Write Access do not drain quota.

This appears to be because the "Try it" on each method page makes a call to /sites to retrieve the list of possible SE sites, whether or not the "Try it" feature is even used.

Is this expected? I didn't find anything here with the following searches:

Sure, 4 per page isn't much if you've registered for a key and have upped the quota to 10,000, but for new users starting out browsing the doc (an obvious first step), the unkeyed 300 quota limit can be rather quickly run down just browsing the doc.

Should this be considered a "bug"? Could/should it be fixed either by:

  • An easy, low-hanging change to "Try it" to retrieve 1000 sites at a time to reduce this to single API call? (As @Glorfindel points out in the comments, /sites already allows a pagesize of 1000 anyway, but "Try it" only retrieves 100 at a time.

  • (The real fix, I believe) Having "Try it" not populate the Site list until the user attempts to "Edit"/change the default site from Stack Overflow to something else (if they even need to)

  • Not subtract /sites calls from the unkeyed quota? (from @Glorfindel comment below)

  • (Fallback) Exempting /sites from the quota? This shouldn't be an issue, since it's normally going to be a rather rare call, I would think, for most apps. And existing 30 calls/second limits should still be in place.

4
  • 2
    FWIW, /sites already has a page size exception: with https://api.stackexchange.com/2.3/sites?pageSize=1000 you'll get all sites at once.
    – Glorfindel
    Apr 27 at 19:48
  • 1
    @Glorfindel Well that's nice - At least the "Try it" feature could be (easily) changed to utilize that to cut down the number of requests from 4 to 1. Apr 27 at 19:49
  • 1
    It already uses the Documentation's own key; another way to solve it would be to not subtract requests with a key from a user's 'generic' 300/day quota.
    – Glorfindel
    Apr 27 at 19:52
  • 1
    @Glorfindel Yes, that would work as well. It still subtracts quota on my own keyed requests as well, of course, but with the higher limit that's not (shouldn't be) a problem. Apr 27 at 19:55

0

You must log in to answer this question.

Browse other questions tagged .