This is a simple JSON API for creating/reading/deleting a user.
To get the server running on a Mac/Linux PC you should be able to just clone this repository, and then from the parent directory run bundle to install all the required Gems.
To start the server run rackup which should then run the server on http://localhost:9292.
If you have an issue with Ruby versions you may need to install rvm or rbenv as this requires Ruby 2+ to work properly
This saves a new user to the database.
Required fields:
- username - This can be any string
- email - A valid email address
- password - There is no strict validation on passwords, any string is accepted
POST /users
Request body:
{username: 'test', email: 'test@example.com', password: '123password'}
Response body:
{id: 123, username: 'test', email: 'test@example.com'}
This fetches an already saved user from the database.
GET /users/123
Response body:
{id: 123, username: 'test', email: 'test@example.com'}
This deletes an already saved user from the database.
You will need to authenticate in order to do this. Please add to your HTTP request the header Authorize with the value of the secret API key.
DELETE /users/123
Request Header:
Authorize: 12345abc
In this instance the server will respond with only a 204 status code if the user was successfully deleted.