Account - rouen-ssi/scims-api GitHub Wiki

Login

  • 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.

Request

{
    "email": [EMAIL],
    "password": [PASSWORD]
}
Parameter Desc.
[EMAIL] The user's email address
[PASSWORD] The user's password

Response

Success

{
    "token": [TOKEN],
    "uid": [UID],
    "first_name": [FIRST_NAME],
    "last_name": [LAST_NAME],
    "biography": [BIOGRAPHY]
}

Failure

{
    "errors": [
        // See below
    ]
}
Error Desc.
[INVALID_CREDENTIALS] The given credentials are invalid

Create an account

  • URL: /account/create
  • Method: POST

Request

{
    "email": [EMAIL],
    "first_name": [FIRST_NAME],
    "last_name": [LAST_NAME],
    "password": [PASSWORD]
}

Response

Success

Just returns HTTP 200

Failure

{
    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.)

Get user's informations

  • URL: /account/<uid>
  • Method: GET

Where <uid> is the user's uid.

Response

Success

{
    "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

Error Desc.
[INVALID_TOKEN] The token is invalid or expired
[USER_NOT_FOUND] The given uid is not found

Update email

  • URL: /account/email
  • Method: PUT
{
    "email": <the new email address>
}

Response

Success

an HTTP 200 status

Failure

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

Failure

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
⚠️ **GitHub.com Fallback** ⚠️