Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A quick and easy way to visually test your Rails application's API.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
lib
script
spec
.gitignore
.rspec
.travis.yml
Gemfile
README.md
Rakefile
api_taster.gemspec

README.md

ApiTaster Build Status Dependency Status

A quick and easy way to visually test out your application's API.

Why?

There are already many awesome API clients (such as Postman), so why reinvent the wheel?

API Taster compared to alternatives, have the following advantages:

  • API endpoints are automatically generated from your Rails routes definition
  • Defining post params is as easy as defining routes
  • Post params can be shared with your test factories

Usage

Add API Taster in your gemfile:

gem 'api_taster'

Mount API Taster, this will allow you to visit API Taster from within your app. For example:

Rails.application.routes.draw do
  mount ApiTaster::Engine => "/api_taster"
end

Add API Taster into the autoload paths in application.rb:

config.autoload_paths += %W(
  #{ApiTaster::Engine.root}
)

In routes.rb, define parameters for each API endpoint after the normal routes definition block. For example:

ApiTaster.routes do
  get '/users'

  post '/users', {
    :user => {
      :name => 'Fred'
    }
  }

  get '/users/:id', {
    :id => 1
  }

  put '/users/:id', {
    :id => 1, :user => {
      :name => 'Awesome'
    }
  }

  delete '/users/:id', {
    :id => 1
  }
end

That's it! Enjoy! :)

License

This gem is released under the MIT License.

Author

Fred Wu, originally built for Locomote.

Something went wrong with that request. Please try again.