As work has progressed on the upcoming second version of our API, we've come to a bit of an impasse that's going to force a semi-radical change.
Here's the root of the issue:
- once you've gotten an auth token over OAuth, you've got a password equivalent-ish (closer in > 2.0) token
- naturally, all communication with that token needs to go over HTTPS
- we have a bajillion different domains on the Stack Exchange network
- the # of certs necessary to cover our existing API endpoint scheme is untenable
Of course, even in a best case we'd have distinct certs for stackoverflow, superuser, serverfault, askubuntu, stackexchange, and stackauth.
We've got a couple options:
- bite the bullet, and live with needing a few hundred certificates down the line
- move everything under
api.stackexchange.com
using a header to select the site - likewise, but embed the site in the path as in
api.stackexchange.com/stackoverflow.com/2.0/questions
- again, but use a query string as in
api.stackexchange.com/2.0/questions?host=stackoverflow.com
Option #1 is immediately out, our system administrators would kill me in cold blood. Of the three tractable solutions, I'm inclined to go with #4.
My rational is: lots of developers do quick queries against web APIs from a browser, and there's no easy way to slap a header onto a request; so #2 would increase development difficulty. Coupled with some frameworks restricting access to headers, I'm strongly disinclined to persue #2.
The difference between #3 and #4 is largely aesthetic. Our use of vectorized parameters makes for some very large paths already, and we have to make some special tweaks to our stack to handle such large paths; embedded a host in there would require some extra work on our end.
This will have no effect on v1.x
The existing api endpoints would continue to exist, only v2.0 will be affected. Naturally, all subsequent API versions will also live under api.stackexchange.com
.
A quick progress report
Interally, API v2 has implementions of all existing /questions
and /users
routes as well as some of the "weirder" methods (like /stats
, now known as /info
) to demonstrate the robustness of the filter system.
Work has started on authentication, though this certificate issue has greatly slowed progress there.
Accordingly, it is unlikely that we will be ready to enter private beta next week; though we are still on track for a final release this calendar year.
apple
,gaming
,wordpress
etc?*.stackexchange.com
off the end and using the remainder instead.*.stackexchange.com
matchesmath.stackexchange.com
but notapi.math.stackexchange.com
orapi.meta.math.stackexchange.com
. It's kind of a crock IMO, but that's the way they work.api.
api.
anything but the lowest subdomain, can't think of anyone who does differently. That'd also still be a lot of certs,*.stackexchange.com
,*.api.stackexchange.com
,*.meta.api.stackexchange.com
, and then equivalents for SO, SU, SF, Stack Apps, Ask Ubuntu, and*.stackauth.com
. Schemes 2, 3, & 4 get us down to two,*.stackexchange.com
and*.stackauth.com
.