Github also versions their API via headers, but uses the `Accept` header instead: https://developer.github.com/v3/media/
I don't understand why they didn't just use the X-GitHub-Media-Type header as a request header.
21–30 of 53 posts
Github also versions their API via headers, but uses the `Accept` header instead: https://developer.github.com/v3/media/
I don't understand why they didn't just use the X-GitHub-Media-Type header as a request header.
Does anyone know if there's a publicly-available Ruby gem for doing what's described in this blog post - i.e., cascading transformations with a nice DSL? If someone from Stripe reads this, I think you could count on some decent community interest for this framework if you ever consider open-sourcing it.
https://github.com/bwillis/versioncake
"Version Cake is an unobtrusive way to version APIs in your Rails or Rack apps."
Github also versions their API via headers, but uses the `Accept` header instead: https://developer.github.com/v3/media/
Have run into more than one issue with the vary: Accept being ignored, resulting in everyone getting the result from the first man in regardless of header variance.
Especially noticeable when we tried supporting both JSON and XML via the accepts header, with the version in the mime.
This is awesome. As someone who's built many APIs, I have always wondered how Stripe managed all those versions. I knew their code couldn't just be littered with if/thens. This is a really smart way to do it. One question is, over the years, wouldn't you add a lot of overhead to each request in transformation? Or do you have a policy where you expire versions that are more than 2 years old, etc? (skimmed through part…
Assuming that Stripe's userbase grows over time and that their new API versions offer features that are useful to a significant portion of their existing userbase, I would expect the majority of requests at any time to be for a recent API version that needs few (or no) transformations. This is especially likely considering that Stripe provides official client libraries (which are presumably up to date) for a lot of l…
I'm not sure how true that is. In my experience, integrations with online payment services are mostly write-only code: you do it, you test it, and then no-one goes near it once it's in production unless there's some sort of known bug or security issue.
Literally the last thing I want to do with working, tested code integrating with the service that collects money for a business is make unnecessary changes that might break it. I know several businesses that use versions of APIs that are several years old with services like Stripe, because they have no need to change.
I think this is one area where GraphQL really excels. It essentially can handle all of this versioning for you (as clients specify EXACTLY what they want) - you just need to make sure that as you evolve your schema that existing fields are left as-is and you only add new fields (not an easy task, but no harder than what you have to do in Stripe's protocol).
Always excited to hear Stripe talking about versioning :D For anyone else who's interested, they've written/talked about this a few times over the years, to fill out the picture: - http://amberonrails.com/move-fast-dont-break-your-api/ - https://www.heavybit.com/library/video/move-fast-dont-break-... - https://speakerdeck.com/apistrat/api-versioning-at-stripe - https://brandur.org/api-upgrades - https://news.ycombina…
Additionally, devs would need to specify what their changes were independent of where they made the change, which meant that our API reference (which can display warning flags next to changed fields) was missing changes. With the new system we can enforce that the change being made is properly documented, since we know that it's encapsulated inside of the change class itself.
Github also versions their API via headers, but uses the `Accept` header instead: https://developer.github.com/v3/media/
I consider this a misuse of the Accept header. They're defining a bunch of custom media types, which in of itself is pretty weird, but then they're not actually using those media types as the Content-Type of the response. So I can send a request where I say 'Accept: application/vnd.github.full+json', but the response I get back is 'Content-Type: application/json; charset=utf-8', which means the server intentionally h…
Nothing in the spec says the Accept and Content-Type must match.
From a consumer of Stripe's API's perspective, doesn't this make debugging or modifying legacy code a real pain? Let's say I'm using Stripe.js API's from a few years ago; where do I go to find the docs for that version? Do I need to look at the API change log and work backwards?
Earlier quoted context omitted.
I consider this a misuse of the Accept header. They're defining a bunch of custom media types, which in of itself is pretty weird, but then they're not actually using those media types as the Content-Type of the response. So I can send a request where I say 'Accept: application/vnd.github.full+json', but the response I get back is 'Content-Type: application/json; charset=utf-8', which means the server intentionally h…
I disagree, if the response body is a valid application/vnd.github.full+json document, then they sent you what you asked for, they just labeled it differently (but still correctly). Nothing in the spec says the Accept and Content-Type must match.
I get that from a practical standpoint the server needs to send back a JSON Content-Type, otherwise a lot of clients won't understand that it's JSON and won't decode it properly. But given this, shouldn't they have picked a different header to declare the API version?
What's the benefit of using the Accept header in this fashion? AFAICT there is no benefit at all over just using a custom header.