News for hackers. Stuff that matters.
Re:Enabling the Future of GitHub's REST API with API Versioning by timrogers on Monday November 28, 2022 @05:19PM (#33780679)
Author here! We think that, most likely, we will end up defaulting to the oldest version. We’ll share specific plans on that when we announce our first version deprecation.

Just so you know, we don’t intend to deprecate `2022-11-28` in two years-ish - we plan to keep versions around for much longer than that. But we offer a commitment of at least 2 years for peace of mind.

Re:Enabling the Future of GitHub's REST API with API Versioning by LennyWhiteJr on Monday November 28, 2022 @06:08PM (#33781194)
What does it mean for a field to be required in new API version but optional in the old version?
Re:Enabling the Future of GitHub's REST API with API Versioning by timrogers on Tuesday November 29, 2022 @05:37AM (#33785883)
Author here! Are you thinking fields in a request or fields in a response?
Re:Enabling the Future of GitHub's REST API with API Versioning by rattray on Monday November 28, 2022 @06:14PM (#33781250)
Hey Tim, nice to see you here!

You might consider behavior more like Stripe's here (disclaimer, former member of the stripe API platform team).

As you're likely aware, Stripe defaults to the latest version for each user, and then stores that as the user's default API Version until they upgrade it at the account level.

This works pretty well, and overall I'd recommend it. It may be better to give each API Key its own default API version, since different applications may expect different versions, and API keys can be a simple way to differentiate applications.

Some of Stripe's client libraries also enforce sending a specific API version header to ensure the types are correct; my guess is that in practice, this is how most requests have their version dictated now, making the account-level setting a little anachronistic.

Everything gets trickiest when it comes to webhook bodies, since the way the payload is rendered may be different across versions, so you can have one app create an object on version A and then a different app consume the webhook under version B and see the created object with a different shape. I'm not familiar enough with GitHub's API to know how best to handle this sort of thing.

Anyway, good luck and happy to chat more.

Re:Enabling the Future of GitHub's REST API with API Versioning by leipert on Monday November 28, 2022 @06:18PM (#33781296)
> It may be better to give each API Key its own default API version, since different applications may expect different versions, and API keys can be a simple way to differentiate applications

That would not work if I (leipert) build a client against version 2022-11-28 and you (rattray) create an API token to use with that client on a later date though, right?

Re:Enabling the Future of GitHub's REST API with API Versioning by frosted-flakes on Monday November 28, 2022 @06:54PM (#33781648)
You can manually set the API version associated with the token.
Re:Enabling the Future of GitHub's REST API with API Versioning by rattray on Monday November 28, 2022 @08:20PM (#33782450)
Correct – and when creating the API Key, you'd want the API to give helpful hints about what other parts of the application use (which is trickier than it sounds).
Re:Enabling the Future of GitHub's REST API with API Versioning by leipert on Tuesday November 29, 2022 @03:55AM (#33785209)
Ah. That makes sense. Similar to choosing scopes then.
Re:Enabling the Future of GitHub's REST API with API Versioning by easton on Monday November 28, 2022 @07:11PM (#33781799)
It works for stripe because it’s one account per company, for GitHub you’d probably set it at the organization level, which would be a bit confusing for personal accounts as you say. I think you could still do it for personal accounts if you allow some kind of override.
Re:Enabling the Future of GitHub's REST API with API Versioning by pbreit on Monday November 28, 2022 @09:21PM (#33782883)
2022-11-28 will never* go away.

[*] never meaning a long time

Re:Enabling the Future of GitHub's REST API with API Versioning by mxscho on Monday November 28, 2022 @10:27PM (#33783350)
The commitment to a 2 year grace period for deprecated API versions would only start at the release date of the succeeding API version, right? Many consumers are maybe only interested in the time they have to switch, not the general lifetime of a specific version.