Gets all users and their picks
Expected response:
[
{
"id": 1,
"email": "alexjmarchant@gmail.com",
"paid": true,
"picks": {
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}
},
{
"id": 2,
"email": "larsonlaidlaw@gmail.com",
"paid": false,
"picks": {
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}
}
]Creates a new user
Expected request:
{
"email": "alexjmarchant@gmail.com",
"password": "12345678",
"passwordConfirmation": "12345678"
}Expected response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImVtYWlsIjoiYWxleGptYXJjaGFudEBnbWFpbC5jb20ifQ.lTKwBXQ09u7JEscdJLDMidHLYLOBvKym8Or7UWsJGXo"
}REQUIRES AUTH
Get's current user info
Expected response:
{
"id": 13,
"email": "alexjmarchant@gmail.com",
"admin": true,
"paid": true
}REQUIRES AUTH
Update current user
Expected request:
{
"paid": true
}Creates a new JWT token
Expected request:
{
"email": "alexjmarchant@gmail.com",
"password": "12345678"
}Expected response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6ZmFsc2UsImVtYWlsIjoiYWxleGptYXJjaGFudEBnbWFpbC5jb20ifQ.lTKwBXQ09u7JEscdJLDMidHLYLOBvKym8Or7UWsJGXo"
}REQUIRES AUTH
Gets the current user's picks
Expected response:
{
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}REQUIRES AUTH
Creates/updates the current user's picks
Expected request:
{
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}Expected response:
Status 200
REQUIRES AUTH & ADMIN
Updates winning picks
Expected request:
{
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}Expected response:
Status 200
Must pass token in a header: Authorization: Bearer <token>
All errors respond with an error message and an appropriate status code:
{
"error": "Example error message"
}READ ONLY
Expected responses:
Winners update:
{
"type": "winnersUpdated",
"winners": {
"Best Picture": "Spider-Man: Into the Spider-Verse",
"Best Director": "Bob Persichetti, Peter Ramsey, Rodney Rothman"
}
}READ/WRITE
Expected requests:
Send message:
{
"type": "postChatMessage",
"token": "XXX",
"body": "Hello, World!"
}Expected responses:
Receive messages:
{
"type": "newChatMessages",
"chatMessages": [
{
"id": 1,
"userId": 1,
"userEmail": "alexjmarchant@gmail.com",
"createdAt": "2019-01-28T23:02:36.651693-05:00",
"body": "Hello, World!"
}, {
"id": 2,
"userId": 2,
"userEmail": "larsonlaidlaw@gmail.com",
"createdAt": "2019-01-28T23:02:36.651693-05:00",
"body": "!dlroW ,olleH"
}
]
}Error:
{
"type": "error",
"error": "There was an error"
}