{"action":"created","issue":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/874","repository_url":"https://api.github.com/repos/cerebris/jsonapi-resources","labels_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/874/labels{/name}","comments_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/874/comments","events_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/874/events","html_url":"https://github.com/cerebris/jsonapi-resources/issues/874","id":182579061,"number":874,"title":"Allow use of version in Accept Header","user":{"login":"pixelhandler","id":17178,"avatar_url":"https://avatars.githubusercontent.com/u/17178?v=3","gravatar_id":"","url":"https://api.github.com/users/pixelhandler","html_url":"https://github.com/pixelhandler","followers_url":"https://api.github.com/users/pixelhandler/followers","following_url":"https://api.github.com/users/pixelhandler/following{/other_user}","gists_url":"https://api.github.com/users/pixelhandler/gists{/gist_id}","starred_url":"https://api.github.com/users/pixelhandler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixelhandler/subscriptions","organizations_url":"https://api.github.com/users/pixelhandler/orgs","repos_url":"https://api.github.com/users/pixelhandler/repos","events_url":"https://api.github.com/users/pixelhandler/events{/privacy}","received_events_url":"https://api.github.com/users/pixelhandler/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-12T17:00:06Z","updated_at":"2016-10-26T16:10:48Z","closed_at":"2016-10-26T15:24:27Z","body":"Allow versioning of an API endpoint via Accept header like so:\r\n\r\n    application/vnd.api+json;version=1\r\n\r\nPerhaps allow for configuration to allow the check to use a loose match of \"begins with\" for the accept header.\r\n\r\nThe JSON API spec concluded **without any media type parameters**…\r\n\r\n> Clients that include the JSON API media type in their `Accept` header **MUST** specify the media type there at least once without any media type parameters.\r\n\r\nBut that limits a good strategy for versioning an API endpoint via Accept Header. The Accept header generally allows media type parameters, see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html\r\n\r\nMotivations:\r\n\r\n- https://github.com/EDMC/api-versions#versions-are-specified-by-header-not-by-url \r\n- http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http#i_want_my_api_to_be_versioned\r\n- https://www.troyhunt.com/your-api-versioning-is-wrong-which-is/\r\n- https://blog.pivotal.io/pivotal-labs/labs/api-versioning\r\n\r\nRelated Comment on the spec - https://github.com/json-api/json-api/issues/406#issuecomment-253261749\r\n\r\n\r\nIt would be great if `ActsAsResourceController#valid_accept_media_type?` could accept `\"application/vnd.api+json;version=1\"`\r\n\r\nFor example, I use https://github.com/EDMC/api-versions \r\n\r\nThe workaround is to re-define the method like so:\r\n\r\n```rb\r\ndef valid_accept_media_type?\r\n  media_types = media_types_for('Accept')\r\n\r\n  media_types.blank? ||\r\n    media_types.any? do |media_type|\r\n      (media_type.start_with?(JSONAPI::MEDIA_TYPE) || media_type.start_with?(ALL_MEDIA_TYPES))\r\n    end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/comments/256398478","html_url":"https://github.com/cerebris/jsonapi-resources/issues/874#issuecomment-256398478","issue_url":"https://api.github.com/repos/cerebris/jsonapi-resources/issues/874","id":256398478,"user":{"login":"krainboltgreene","id":334809,"avatar_url":"https://avatars.githubusercontent.com/u/334809?v=3","gravatar_id":"","url":"https://api.github.com/users/krainboltgreene","html_url":"https://github.com/krainboltgreene","followers_url":"https://api.github.com/users/krainboltgreene/followers","following_url":"https://api.github.com/users/krainboltgreene/following{/other_user}","gists_url":"https://api.github.com/users/krainboltgreene/gists{/gist_id}","starred_url":"https://api.github.com/users/krainboltgreene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krainboltgreene/subscriptions","organizations_url":"https://api.github.com/users/krainboltgreene/orgs","repos_url":"https://api.github.com/users/krainboltgreene/repos","events_url":"https://api.github.com/users/krainboltgreene/events{/privacy}","received_events_url":"https://api.github.com/users/krainboltgreene/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T16:10:48Z","updated_at":"2016-10-26T16:10:48Z","body":"Yeah I tried this and ended up having to change three other methods and two\nother configurations and it still didn't work.\n\nOn Oct 26, 2016 8:25 AM, \"Dan Gebhardt\" <notifications@github.com> wrote:\n\n> Closed #874 <https://github.com/cerebris/jsonapi-resources/issues/874>.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/cerebris/jsonapi-resources/issues/874#event-837229850>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AAUb2ZFNguTUvPf3YDgz2jNPab_gUUvAks5q33CwgaJpZM4KU-7b>\n> .\n>\n"}}
{"actor":{"display_login":"krainboltgreene"}}