Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

Hi there!

Because the API uses a key, I'd like to ask if a request can be created so that, on application start (and, during runtime), you can ask whether your key is valid, and get back information about your current request quota (and any other pertinent information, such as possible downtime).

One of the side-benefits of this is that if, an API key is invalid, or the quota has been exhausted, the response will show that, and thus, not send any more requests (reducing possible load problems against the API).

http://api.stackoverflow.com/n.n/about/{key}

Returns

{
  "about": {
    "documentation": "Gets the status and quota of the account associated with 'key'.",
    "parameters": {
      "quota_used": {
        "description": "how many requests have been used against the current IP address",
        "values": "number"
      },
      "quota_remaining": {
        "description": "how many requests are available against the current IP address",
        "values": "number"
      },
      "server_time": {
        "description": "time on the server",
        "values": "number"
      },
      "next_downtime": {
        "description": "when (if any) the next expected downtime period will be",
        "values": "number"
      },
      "api_version": {
        "version": {
          "description": "api version",
          "values": "string"
        },
        "revision": {
          "description": "site revision",
          "values": "string"
        }
      }
    }
  }
}

I believe that X-RateLimit-Current and X-RateLimit-Max have been mentioned as a way of getting them from each response, and this is fine, I suppose.

share|improve this question
2  
For me, a simple call to the stats method with my key would give me enough info about my key's quotas. The server_time is a goody I could live without. The next_downtime probably can't be implemented with a true meaning, and the version is useless, as your code should target a single version anyway. –  Martin Plante May 23 '10 at 15:15

1 Answer 1

up vote 4 down vote accepted

Everything you want here is already implemented, except for next_downtime, which requires a level prescience we don't yet possess.

API version is already served by the /stats method.

Quota information is found in the X-RateLimit-Current & X-RateLimit-Max response headers.

share|improve this answer
    
Thanks for the answer. –  Dan Atkinson May 23 '10 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .