#API-HLT
Rails API for creating, updating, and listing blog posts and categories.
To test drive the Rails API:
- Git clone the repository
- Run
$ bundle
- Migrate and seed the SQLite3 databases (
rake db:migrate
andrake db:seed
) - When you seed the database, an
auth_token
is printed out for you to use in testing. - Start the server,
$ rails s
, and browse tolocalhost:3000
- View existing category's list and associated blog posts
- Create and update blogs posts (through curl or Postman)
- To visualize the JSON data, add .json to the end of the URL
- Or use a tool like the Postman - REST Client Chrome extension to visualize and manipulate the JSON data
- Create a custom Accept header preset
- Click Manage Presets and create a header preset called
JSON Accept
- Set the
key
toAccept
- Set its
value
toapplication/json
- Click Manage Presets and create a header preset called
- Create a custom Authorization header preset
- Click Manage Presets and create a header preset called
JSON Authorization
- Set the
key
toAuthorization
- Set its
value
toToken token="tokenGoesHere"
- Click Manage Presets and create a header preset called
- Create and access the JSON data with the following URL / HTTP verb combinations
- http://localhost:3000/categories/ with GET
- http://localhost:3000/categories/83/ with GET (substitute the number 83 for a relevant category ID based on the results of your
seeds.rb
file seeding) - http://localhost:3000/categories/84/posts/480 (substitute the numbers 84 and 480 for a relevant category and post ID based on the results of your
seeds.rb
file seeding)- Use the Authorization custom header with POST, PUT, PATCH or DELETE
- Substite tokenGoesHere with a user's auth_token attribute.
- When you seed the database, an
auth_token
is printed out for you to use in testing. - Alternatively, you can obtain one from the
rails console
by runningUser.first
- When you seed the database, an
- http://localhost:3000/categories/84/posts/ with POST, along with form-data
- http://localhost:3000/categories/84/posts/480 with PUT or PATCH, along with altered form-data
- http://localhost:3000/categories/84/posts/480 with DELETE
- Create a custom Accept header preset
- To run the request specs, call
$ rspec
from the command line