oauth-cli

a simple CLI client to test your oauth API easily

Installation

oauth-cli is packed as gem, install with:

gem install oauth-cli

Usage

oauthc [options] [http_method_verb uri [body]]

Options:

--help             Display this message
--profile          Name of preset profile to load, put profiles to a yaml file in ~/.oauthconfig
--host             Host to connect to
--consumer_key     Consumer Key
--consumer_secret  Consumer Secret
--token            Authentication Token
--token_secret     Authentication Secret
--mime_type        Set mime type, default: application/xml
--content_type     Set content type, default: application/xml

Request params (leave blank for interactive mode)

http_method_verb  any method of get, post, put or delete
uri               Uri to request
body              Body attached to request

Interactive Mode

if no request params are specified, interactive mode is started. Those commands are available:

Interactive Commands:

get     uri          Get request for given uri
post    uri  [body]  Post request for given uri, asks for body if not provided
put     uri  [body]  Put request for given uri, asks for body if not provided
delete  uri          Delete request for given uri

auth                 Request authentication token
help                 Display this message

Examples

oauthc was originally developed to test the Qype API. Run these examples agains it:

post /feedbacks '<feedback><link href="http://api.qype.com/v1/reviews/66"  rel="http://schemas.qype.com/review"/><comment><![CDATA[This review contains offending text]]></comment></feedback>'
post /places/31/checkins '<checkins><point>53.5505,9.93631</point></checkins>'
get /positions/53.55224,9.999/recommended_places
get /locators/de600-hamburg/feed
get /badges
get /users/tobiasb/badges
get /places/31.json?expand=popular_checkins

Hints

Todos

  • check if host is valid

  • testing + better docs

  • check oauth client, streamline!?

  • add autocomplete for API commands

  • profile delete and rename

  • history scope of profile name

  • support for urlencoded in post/put body -> set correct mime type

FAQ

What’s the difference to the client provided by oauth gem?

problem with oauth cli client provided with the gem is the lack of post request with body content as well as easy usage with repl to have proper CLI options

Are there other clients of similar manner?

Yes: github.com/marcel/twurl Very similar but Twitter specific. I whish I’d spot this project earlier ;-)

The MIT License

Copyright © 2010 RngTng, Tobias Bielohlawek

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More

Easy way to create your gem: