User login Endpoint

Prev Next

User Login Endpoint

This endpoint is used to authenticate users by logging them into the system. Upon successful authentication, the endpoint returns user details along with a session token.

Request

  • Method: POST

  • URL: https://{{base_url}}/zhb/api/v1/users/public/login

Request Body

The request body should be sent in JSON format and must include the following parameters:

  • username (string): The username of the user attempting to log in.

  • password (string): The password associated with the provided username.

Example Request Body:

{
  "username": "{{user}}",
  "password": "{{passwd}}"
}

Response

On successful authentication, the server responds with a JSON object containing the following fields:

  • username (string): The username of the authenticated user.

  • email (string): The email address associated with the user account.

  • status (string): The current status of the user account (e.g., active, inactive).

  • type (string): The type of user (e.g., admin, regular).

  • role (string): The role assigned to the user within the system.

  • biAuthInfo (object): An object containing Sisense BI authentication information.

    • token (string): A session token used for subsequent authenticated requests.

    • userId (string): The unique identifier for the user.

  • groupsNames (array): An array containing the names of groups the user belongs to.

  • token (string): A token for session management.

Example Response:

{
  "username": "",
  "email": "",
  "status": "",
  "type": "",
  "role": "",
  "biAuthInfo": {
    "token": "",
    "userId": ""
  },
  "groupsNames": [],
  "token": ""
}

Status Codes

  • 200 OK: Indicates that the login was successful and the response contains user details.

  • 4xx/5xx: Other error codes may indicate issues such as invalid credentials or server errors.

Ensure to handle the response appropriately based on the status returned.