This is an API for an example message board. It allows users to sign up, view groups and messages, log in, and create/update/delete their own messages.
To install on your own machine, follow the instructions below:
- Clone this repository.
- Run the following commands in the project root directory:
bundle update rake db:setup rails db:seed rails s -p 3001
- Open
localhost:3001
in your web browser
All API calls besides creating a new user require an api key.
Posting, editing, and deleting messages requires an authentication token acquired from the Post /authenticate
in addition to the api key.
Limited to 1000 requests per day per api key.
Preface all api calls with /api/v1
Post /users
- Parameters
- email:
string
(required) - name:
string
(required) - password:
string
(required)
- email:
- Creates an account with the given user name, email, and password, and returns the user's api key.
- Parameters
POST /authenticate
- Parameters
- key:
string
(required) - email:
string
(required) - password:
string
(required)
- key:
- Returns an authentication token for the user with provided email and password.
- Parameters
GET /groups
- Parameters
- key:
string
(required)
- key:
- Returns all groups.
- Parameters
GET /groups/{group_id}
- Parameters
- key:
string
(required)
- key:
- Returns information about the group with provided group_id.
- Parameters
GET /groups/{group_id}/messages
- Parameters
- key:
string
(required) - start_time:
timestamp
(optional) - end_time:
timestamp
(optional)
- key:
- Returns all messages for the group with provided group_id. Limits to messages created between start_time and end_time if both params are provided.
- Parameters
POST /groups/{group_id}/messages
- Headers
- Authorization:
string
(required)
- Authorization:
- Parameters
- key:
string
(required)
- key:
- Posts a new message to the group with provided group_id.
- Headers
PUT /groups/{group_id}/messages/{message_id}
- Headers
- Authorization:
string
(required)
- Authorization:
- Parameters
- key:
string
(required)
- key:
- Edits the message with provided message_id in group with group_id.
- Headers
DELETE /groups/{group_id}/messages/{message_id}
- Headers
- Authorization:
string
(required)
- Authorization:
- Parameters
- key:
string
(required)
- key:
- Deletes the message with provided message_id in group with group_id.
- Headers
Please contact [email protected] with questions, comments, or issues.
- Ruby
- Rails
- Rack::Throttle
Token-Based Authentication from this tutorial.
Copyright (c) 2017 Kelsey Langlois
This software is licensed under the MIT license.