Base URL: https://sp-conjugator-be.herokuapp.com
POST to /api/auth/register
Send:
{
"name": "Dave",
"email": "email@email.com",
"password": "password"
}
Get Back:
{
"id": 8,
"name": "Dave",
"email": "email@email.com"
}
POST to /api/auth/login
Send:
{
"email": "email@email.com",
"password": "password"
}
Get Back:
{
"message": "Welcome, Dave.",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo1LCJpYXQiOjE1NjY3Nzk1OTcsImV4cCI6MTU2Njg2NTk5N30.yFjcXl4OS3ielV0ROHZ2FhjS5s38JKqf2R2mwb5wA2o"
}
Save the token to local storage and send in header of all requests that need the user to be authenticated. For logout behavior, delete the token from local storage.
GET to /api/users/:id
Send user id as part of the url. Send token in request header using "Athorization" property.
{
"Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo1LCJpYXQiOjE1NjY3Nzk1OTcsImV4cCI6MTU2Njg2NTk5N30.yFjcXl4OS3ielV0ROHZ2FhjS5s38JKqf2R2mwb5wA2o"
}
Get Back:
{
"id": 2,
"name": "Dave",
"email": "email@email.com",
"daily_goal": 0,
"daily_progress": 0,
"streak_days": 0
}
PUT to /api/users/:id
Send user id as part of the url. Send token in request header using "Athorization" property.
{
"Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo1LCJpYXQiOjE1NjY3Nzk1OTcsImV4cCI6MTU2Njg2NTk5N30.yFjcXl4OS3ielV0ROHZ2FhjS5s38JKqf2R2mwb5wA2o"
}
Send updates in request body: These properties may be updated: name, email, daily_goal, daily_progress, streak_days.
{
"daily_goal": 5,
"streak_days": 1
}
Get Back the updated user:
{
"id": 2,
"name": "testing",
"email": "testing@email.com",
"daily_goal": 5,
"daily_progress": 0,
"streak_days": 1
}
DELETE to /api/users/:id
Send user id as part of the url. Send token in request header using "Athorization" property.
{
"Authorization": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijo1LCJpYXQiOjE1NjY3Nzk1OTcsImV4cCI6MTU2Njg2NTk5N30.yFjcXl4OS3ielV0ROHZ2FhjS5s38JKqf2R2mwb5wA2o"
}
Get Back the following:
{
"message": "Removed!"
}
GET to /api/verbs
Get back the list of verbs:
{
"id": 1,
"verb": "hablar",
"conjugation": "hablas",
"tense": "Present",
"form": "Tu",
"sentence": "¿Así que hablar portugués? Qué variante, ¿la de Portugal o la de Brasil? "
},
{
"id": 2,
"verb": "hablar",
"conjugation": "hablaríamos",
"tense": "Conditional",
"form": "Nosotros",
"sentence": "Nuestro Presidente dijo anteriormente que hablar de la decoración. "
},
{
"id": 3,
"verb": "hablar",
"conjugation": "hablará",
"tense": "Future",
"form": "Usted, él, ella",
"sentence": "Todos sabemos que se hablar de ello en la reunión del Consejo Europeo. "
},
...