- Ruby version ruby 2.1.5p273
- Get All Users
GET '/users'
- Register User
POST '/users/register'
- Login User
POST '/users/login'
- Get All Comics
GET '/comics'
- Show Comic
GET'/comic/title'
- Create Comic
POST '/comics/create'
- Get All Of User's Comics
GET 'comics/user'
- Create Photo
POST 'photos/create'
- Get User Photos
GET 'photos/user'
- Get A User Photo
GET 'photo/:id'
- Get All Users' Photos
GET 'photos/users'
GET '/users'
Params:
- none
- Returns and array of all users
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{
"user": [
{
"id": 1,
"username": "jsmith1234",
"access_token": "083a050c4b1556c5b8ca68612f2b5c9f",
"email": "jsmith@tiy.com"
},
{
"id": 2,
"username": "BJohnson1234",
"access_token": "c9d85bbde2fde34c1cab0e1995216043",
"email": "BJohnson@tiy.com"
},
{
"id": 3,
"username": "TMcGraw1234",
"access_token": "908ab2d13e18b6d436c2908f83fe9adf",
"email": "TMcGraw@tiy.com"
}
]
}```
Example failure:
```json
{"errors": ["errors":["Email has already been taken"]]}
POST '/users/register'
Params:
- username: a string
- email: a string
- password: a string
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{
"user": {
"id": 1,
"username": "jsmith1234",
"access_token": "083a050c4b1556c5b8ca68612f2b5c9f",
"email": "jsmith@tiy.com"
}
}
Example failure:
{"errors": ["errors":["Email has already been taken"]]}
POST '/users/login'
Params:
- username: a string
- password: a string
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{
"user": {
"id": 3,
"username": "TMcGraw1234",
"access_token": "908ab2d13e18b6d436c2908f83fe9adf",
"email": "TMcGraw@tiy.com"
}
}
Example failure:
{ "message":"Invalid Login" }
GET 'comics'
Params:
- none
- Returns array of comics from all users.
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "user":{"id":2,
"username":"JDrama2000",
"points":20 }}
Example failure:
{"errors": ["errors":["Error"]]}
GET 'comic/title'
Params:
- none
- Returns the selected comic.
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{
"post": [
{
},
{
"image": "www.photos.com/photos4",
"user_id": 4,
"answer": "answer",
"image": "www.photo.com/photo",
"user_id": 1,
"answer": 1,
"complete": false
},
{
"image": "www.photo.com/photo",
"user_id": 2,
"answer": 1,
"complete": false
},
{
"image": "www.photo.com/photo",
"user_id": 3,
"answer": 1,
"complete": false
},
{
"image": "www.photo.com/photo",
"user_id": 4,
"answer": 1,
"complete": false
}
]
}
Example failure:
{"errors": ["errors":["Error when loading posts"]]}
POST '/comics/create'
Params:
- none
- Returns a single post
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "post":{"image":"image file",
"user_id":3,
"answer":"correct answer",
"complete":false,
"answer_1":"incorrect answer",
"answer_2":"incorrect answer",
"answer_3":"incorrect answer"}}
Example failure:
{ "message":"Access Token Not Found" }
GET 'comics/user'
Params:
- none
- Retrieves all of a user's commics.
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "post":{"id":6,
"image":"null",
"user_id":3,
"answer":"correct",
"complete":false,
"answer_1":"incorrect",
"answer_2":"incorrect",
"answer_3":"incorrect"}}
Example failure:
{ "message":"Access Token Not Found" }
POST 'photos/create'
Params:
- none
- Removes validated users' post
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{"message":"Post deleted"}
Example failure:
{ "message":"ERROR" }
GET 'photos/user'
Params:
- guess: "string"
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "user":{"id":2,
"guess":"A",
"point":1,
"user_id":3,
"post_id":6,
"access_token":"25a0eea82cd2fd34c34ddadc2447fb92"}}
Example failure:
{ "message":"Access Token Not Found" }
GET 'photo/:id'
Params:
- guess: "string"
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "user":{"id":2,
"guess":"A",
"point":1,
"user_id":3,
"post_id":6,
"access_token":"25a0eea82cd2fd34c34ddadc2447fb92"}}
Example failure:
{ "message":"Access Token Not Found" }
GET 'photos/users'
Params:
- guess: "strings"
Response: Status Code: 201 if successful, 422 if unsuccessful
Example success:
{ "user":{"id":2,
"guess":"A",
"point":1,
"user_id":3,
"post_id":6,
"access_token":"25a0eea82cd2fd34c34ddadc2447fb92"}}
Example failure:
{ "message":"Access Token Not Found" }