File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ Grape APIs are Rack applications that are created by subclassing `Grape::API`. B
1515
1616``` ruby
1717class Twitter ::API < Grape ::API
18- version ' 1 '
18+ version ' v1 ' , :using => :header , :vendor => ' twitter ' , :format => :json
1919
2020 helpers do
2121 def current_user
@@ -68,10 +68,18 @@ run Twitter::API
6868
6969And would respond to the following routes:
7070
71- GET /1/statuses/public_timeline(.json)
72- GET /1/statuses/home_timeline(.json)
73- GET /1/statuses/show/:id(.json)
74- POST /1/statuses/update(.json)
71+ GET /statuses/public_timeline(.json)
72+ GET /statuses/home_timeline(.json)
73+ GET /statuses/show/:id(.json)
74+ POST /statuses/update(.json)
75+
76+ Versioning is handled with HTTP Accept head by default, but can be configures
77+ to [ use different
78+ strategies] ( https://github.com/intridea/grape/wiki/API-Versioning ) . For
79+ example, to request the above with a version, you would make the following
80+ request:
81+
82+ curl -H Accept=application/vnd.twitter-v1+json http://localhost:9292/statuses/public_timeline
7583
7684Serialization takes place automatically. For more detailed usage information, please visit the [ Grape Wiki] ( http://github.com/intridea/grape/wiki ) .
7785
You can’t perform that action at this time.
0 commit comments