Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.22 KB

README.md

File metadata and controls

39 lines (25 loc) · 1.22 KB

Basic RESTful API using Ruby on Rails

I have used this guide Install Ruby on Rails on Ubuntu to install Ruby on Rails

Also this other tutorial Restful Rails API, Just Add Water for the API basics

Server

To start the server just execute start_server.sh

Database

I have used a sqlLite3 database, the schema is included. Execute bin/setup to install dependencies and create the database

Resources

There are two resources, tweets and users

The route for them are

  • /api/users
  • /api/tweets

Create users

You can create an user making a POST request to /api/users with the following parameters

{"name": "John Doe"}

Get users

And get them going to /api/users.json you should include the format, only supported json and xml

Create tweets

POST request to /api/tweets with the following parameters

{"content": "First Tweet", "user_id": 1}

Get tweets

And get them going to /api/tweets.json

You can filter them just passing the user id in the query string /api/tweets.json?user_id=1