URL: /acccount/login
Method: POST
The token is valid 24h. Is the user has a valid token, the endpoint sends the same token. If the user does not have a valid token, the endpoint generates a new token encoded in base64.
{
"email": [EMAIL],
"password": [PASSWORD]
}
Parameter
Desc.
[EMAIL]
The user's email address
[PASSWORD]
The user's password
{
"token": [TOKEN],
"uid": [UID],
"first_name": [FIRST_NAME],
"last_name": [LAST_NAME],
"biography": [BIOGRAPHY]
}
{
"errors": [
// See below
]
}
Error
Desc.
[INVALID_CREDENTIALS]
The given credentials are invalid
URL: /account/create
Method: POST
{
"email": [EMAIL],
"first_name": [FIRST_NAME],
"last_name": [LAST_NAME],
"password": [PASSWORD]
}
Just returns HTTP 200
{
errors: [
// See below
]
}
Error
Desc.
[INVALID_EMAIL]
Invalid email address (empty or malformed)
[EMAIL_ALREADY_EXISTS]
The email already exists
[INVALID_FIRST_NAME]
Invalid first name (empty)
[INVALID_LAST_NAME]
Invalid last name (empty)
[INVALID_PASSWORD]
Invalid password (8 characters min.)
URL: /account/<uid>
Method: GET
Where <uid>
is the user's uid.
{
"uid": "<user's uid>",
"email": "<user's email>",
"last_name": "<user's last name>",
"first_name": "<user's first name>",
"biography": "<user's biography (can be null)",
"highlighted_articles": [
<highlighted_article_id>,
...
]
}
Error
Desc.
[INVALID_TOKEN]
The token is invalid or expired
[USER_NOT_FOUND]
The given uid is not found
URL: /account/email
Method: PUT
{
"email": <the new email address>
}
an HTTP 200 status
Error
Desc.
[INVALID_TOKEN]
The token is invalid or expired
[INVALID_EMAIL]
The given email address is invalid
[EMAIL_ALREADY_EXISTS]
The given email address is already taken
Update user's informations
URL: /account
Method: PUT
{
// All parameters below are optionals
"first_name": "<the user's first name>",
"last_name": "<the user's last name>",
"biography": "<the user's biography>",
"highlighted_articles": [ <article_id>, ... ]
}
## Response
### Success
An HTTP 200 status code
Error
Desc.
[INVALID_TOKEN]
The token is invalid or expired
[INVALID_LAST_NAME]
The given last name is invalid
[ARTICLE_NOT_FOUND]
An highlighted article id is invalid