All API methods can be found at https://api.stackexchange.com/docs
.
All methods accept the following parameters:
type=jsontext
: responds with mime-type text/json
.key={key}
: validates this request to a specific application. (More
here
[1])callback=functionname
: returns
JSON with Padding
[2] instead of standard JSONfilter={filter}
: specifies which fields to returnSite specific methods also take
site={sitename}
: specifies the site to query against, can be the full domain name or just part
stackoverflow.com
, askubuntu
, and gaming
are all validEvery site in the Stack Exchange network [3] supports the API, with the exceptions of stackexchange.com [4], and Area 51 [5].
Old help methods can be found at http://api.stackoverflow.com/1.1/usage
. Further details may be found in the
revision history of this post
[6].
Regarding paged results:
The API's handling of empty paged results seems inconsistent. Some methods return empty sets, some throw a 404.
It is my opinion that an empty set should be returned for any result that is paged and a 404 should be returned when a specific, singular resource is not found (the number of these methods seems to be shrinking).
Having inconsistent handling makes writing code against the API much more tedious than it needs to be, what with having to keep track of which methods play well with others and which just need to be different. ;-)
I think this is a fairly significant concern.
paged routes that throw when empty
/answers/{id}
/comments/{id}
/questions/{id}
/users/{id}
I think we should provide a
JSON-Schema
[1] style description instead of or in addition to the current ?help
syntax. This would make it much easier to consume, and comply to at least somewhat of a proposed standard.
Issues:
The revisions
routes' date keys diverge from the established naming convention.
e.g. all other routes use todate
and fromdate
whereas the revisions
use toDate
and fromDate
.
Are keys case sensitive? If so, could this be addressed? I am building a wrapper and this single exception gives me a rash.
for badges/name
, name
seems to be vestigal.
answers/{id}
implies that id is singular where as a vector is accepted
revisions/{id}/{revisionguid}
- case mismatch between route and definition, revisionguid
!= revisionGuid
/users/{id}/tags
- id is not listed in parameters
For reference: I am writing a self-generating API wrapper for the self-documenting API in the interest of not having to manually test every route and method upon new releases. Simply regenerate and run tests and/or diff to find API changes.
toDate
& fromDate
are incorrect, they will be fixed later today. id
is a bit odd, I'll admit. The name should actually be something like id(s)
, but that obviously won't work. Plus, its never passed as an actual parameter (always implicitly, via the path); I don't really think it merits changing. - Kevin Montrose
badges/name
was an oversight. Shortly, badges
will return all badges, while badges/name
and badges/tags
will return strictly named and tag-based badges respectively. - Kevin Montrose