Rails API for a simple user administration system.
- Authentication with JWT tokens
- Perform CRUD operations on Users
Deploy to AWS on push/merge to master if tests pass, keywords:
- CircleCI
- Capistrano
- AWS
- Amazon RDS
All endpoints are protected and require authentication with JSON Web Tokens (JWT)
name |
type |
notes |
auth |
object |
required. |
auth.phone_number |
string |
required. (test with: "123-123-123") |
auth.password |
string |
required. (test with: "password") |
/signin
json
{
"auth": {
"phone_number": "123-123-123",
"password": "password"
}
}
Status 201 Created
json
{
"jwt": "eyJ0eXAiOiJzI1NiJ9.eyJleHAiOjE1MzcwOTc1NDcsInN1YiI.V3WjeYFN1sazil7b28e0FhgD_SQnP9OR4w0eJ3sNfic"
}
Headers
name |
notes |
Authorization |
Ex: BEARER {post here JWT string} |
Content-Type |
application/json |
Status 200 Ok
json
{
"data": [
{
"id": "1",
"type": "users",
"attributes": {
"phone-number": "123-123-123",
"name": "John Doe"
}
},
{
"id": "2",
"type": "users",
"attributes": {
"phone-number": "321-321-321",
"name": "Fred White"
}
}
]
}
GET /api/v1/users/:user_id
Headers
name |
notes |
Authorization |
Ex: BEARER {post here JWT string} |
Content-Type |
application/json |
Status 200 Ok
json
{
"data": {
"id": "1",
"type": "users",
"attributes": {
"phone-number": "123-123-123",
"name": "John Doe"
}
}
}
Headers
name |
notes |
Authorization |
Ex: BEARER {post here JWT string} |
Content-Type |
application/json |
name |
type |
notes |
user |
object |
required. |
user.phone_number |
string |
required. unique. |
user.name |
string |
required. |
user.password |
string |
required. 4-32 chars |
/api/v1/users
json
{
"user": {
"phone_number": "111-111-111",
"name": "Fred White",
"password": "password"
}
}
Status 201 Created
json
{
"data": {
"id": "4",
"type": "users",
"attributes": {
"phone-number": "111-111-111",
"name": "Fred White"
}
}
}
PATCH /api/v1/users/:user_id
Headers
name |
notes |
Authorization |
Ex: BEARER {post here JWT string} |
Content-Type |
application/json |
name |
type |
notes |
phone_number |
string |
unique. |
name |
string |
|
password |
string |
4-32 chars |
/api/v1/users/4
json
{
"name": "Updated name",
"password": "updated_password"
}
Status 200 Ok
json
{
"data": {
"id": "4",
"type": "users",
"attributes": {
"phone-number": "111-111-111",
"name": "Updated name"
}
}
}