Litmus Portal Authentication API API Reference

Litmus Portal Authentication APIs are used to authenticate the idenity of a user and to perform several user-specific tasks like:

  • Update Profile
  • Change Password
  • Reset Password
  • Create new users etc.
  • API Endpoint
    https://localhost:3000
    Schemes: https, http

    Paths

    GET /status

    This API is used to check the status of the server.

    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "status": "up"
    }
    

    POST /login

    This API is used to login into auth server.

    Field Possible values Mandatory/Optional
    username admin Mandatory
    password pass123 Mandatory
    Request Content-Types: application/json
    Request Example
    {
      "username": "admin",
      "password": "admin"
    }
    
    200 OK

    OK

    type
    object
    401 Unauthorized

    Unauthorized

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MjcxMjY4MjMsInJvbGUiOiJhZG1pbiIsInVpZCI6ImY4MDM2YzUxLTBkNzktNGNkNy1hN2QwLTQ1ZGNhZGI4MGVlYiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.zNIMwocHgmguwtGFupV54UfcfwEdaRO1_xB2ilalqn0fp-JE0ujkHT3gDyepnEGSRm2j1eTopPgtvyRVPb7gGA",
      "expires_in": 86400,
      "type": "Bearer"
    }
    
    Response Example (401 Unauthorized)
    {
      "error": "unauthorized",
      "error_description": "The user does not have requested authorization to access this resource"
    }
    

    GET /users

    This API is used to get the list of users

    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    [
      {
        "_id": "f8036c51-0d79-4cd7-a7d0-45dcadb80eeb",
        "username": "admin",
        "role": "admin",
        "created_at": "1627040098"
      }
    ]
    

    POST /update/password

    This API is used to update the password

    Field Possible values Mandatory/Optional
    username admin Mandatory
    old_password pass123 Mandatory
    new_password pass1234 Mandatory
    Request Content-Types: application/json
    Request Example
    {
      "username": "admin",
      "old_password": "admin",
      "new_password": "litmus"
    }
    
    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "message": "password has been reset"
    }
    

    POST /create

    This API is used to create a new user.

    Field Possible values Mandatory/Optional
    username admin Mandatory
    password pass123 Mandatory
    role admin Mandatory
    email admin Mandatory
    name admin Mandatory
    Request Content-Types: application/json
    Request Example
    {
      "username": "test1",
      "password": "test1",
      "role": "admin",
      "email": "test1@litmus.com",
      "name": "Test Account"
    }
    
    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "_id": "5873815a-1535-4b1c-8766-2fe53c726276",
      "username": "test1",
      "email": "test1@litmus.com",
      "name": "Test Account",
      "role": "admin",
      "created_at": "1627040799"
    }
    

    POST /reset/password

    This API is used to reset the password of a user.

    Field Possible values Mandatory/Optional
    username test1 Mandatory
    new_password pass1234 Mandatory
    Request Content-Types: application/json
    Request Example
    {
      "username": "test1",
      "new_password": "test2"
    }
    
    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "message": "password has been reset successfully"
    }
    

    POST /update/details

    This API is used to update the details of a user.

    Field Possible values Mandatory/Optional
    name test1 Mandatory
    email test1@test.com Mandatory
    role admin Mandatory
    username test1 Mandatory
    Request Content-Types: application/json
    Request Example
    {
      "name": "Administrator",
      "email": "admin@litmus.com",
      "role": "admin",
      "username": "admin"
    }
    
    200 OK

    OK

    type
    object
    Response Content-Types: application/json
    Response Example (200 OK)
    {
      "_id": "f8036c51-0d79-4cd7-a7d0-45dcadb80eeb",
      "username": "admin",
      "email": "admin@litmus.com",
      "name": "Administrator",
      "role": "admin"
    }
    

    POST /updatestate

    This API is used to update the state of a user.

    Request Content-Types: application/json
    Request Example
    {
      "": ""
    }
    
    200 OK

    Successful response

    Response Content-Types: application/json