Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proposal for api versioning #4

Closed
wants to merge 3 commits into from
Closed

Conversation

fespinoza
Copy link
Contributor

i propose to use the Accept header in order to clean URLs of the
resources, and because my main approach on the design of the API is to
use the header to communicate data, because that is why HTTP headers
were built for

and we will use them for several applications, as localization,
caching, authentication, etc.

i propose to use the `Accept` header in order to clean URLs of the
resources, and because my main approach on the design of the API is to
use the header to communicate data, because that is why HTTP headers
were built for

and we will use them for several applications, as localization,
caching, authentication, etc.
request headers

```
Accept: application/vnd.super-app+json; version=1.2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note the definition of a vendor content type, depending on the app vnd.super-app+json

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about these kind of versioning?
GET hyper.super-app.no/api/v1/spaceships

It is also cleaner, but there is a benefit in seeing clearly, what version you are using.
When updating the apps to newer API, only baseURL change would be required to start development with new version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like that approach as well

the reason I am proposing the header version, it's that we will be using headers for many purposes already

and other intelligent people are using headers as well

there is a discussion in that repo as well, but i want to read a little further to understand the choices

but mainly, the purpose of this PR is to evaluate options

@jgorset
Copy link
Contributor

jgorset commented Jun 7, 2015

I like headers, too, but mostly just because that's what headers are for. I guess it makes it harder to share the endpoints because you won't be able to do it with just an URL, but I'm okay with that (you'll probably need to authenticate anyway, and you definitely don't want that part in the URL). So that's 👍 from me.

@jgorset
Copy link
Contributor

jgorset commented Jun 7, 2015

We have some missing capitalizations and punctuations in this pull request though, so I'm fixing those; I think beautifully written English in our playbooks is as important as beautifully written code in our applications. :-)

@jgorset
Copy link
Contributor

jgorset commented Jun 7, 2015

What do you think about this, @hyperoslo/ruby?

@JozoSalt
Copy link

I kinda like using a custom-header for versioning API-Version

And there is this when using Accept header in Rails (from versionist gem):

Accept Header Gotcha

Please note: when your routes do not include an explicit format in the URL (i.e. match 'foos (:format)' => foos#index), Rails inspects the Accept header to determine the requested format. Since an Accept header can have multiple values, Rails uses the first one present to determine the format. If your custom version header happens to be the first value in the Accept header, Rails would incorrectly try to interpret it as the format.

@fespinoza
Copy link
Contributor Author

close because of inactivity

@fespinoza fespinoza closed this Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants