usersApi - n1lby73/industrial-IOT GitHub Wiki

Overview

The Users API endpoint retrieves registered user details. It requires authorization through a valid JSON Web Token (JWT). Only users with the role of "owner" have access to this endpoint.

Endpoint URL

  • URL: https://industrialiot.onrender.com/api/users
  • **Method:**GET

Request Parameters

  • Headers:

    • Authorization: Bearer <ACCESS_TOKEN>
  • Body Parameters: None

Responses

  • Success Response:

    • Status Code: 200 OK

    • Response Body:

      {
          "registeredUsers": [
          {
              "id": 1,
              "username": "example_user",
              "email": "[email protected]",
              "role": "user_role",
              "verified Email": true
          },
          // ... (other user details)
          ]
      }
      
      • Description: Returns details of registered users in JSON format.
  • Error Responses:

    • Status Code: 401 Unauthorized
      • Response Body:

        {
            "Error": "not authorized"
        }
        
      • Description: Indicates unauthorized access for users without the "owner" role.

Usage

  1. Request Method: GET
  2. Endpoint URL: https://industrialiot.onrender.com/api/users
  3. Header: Authorization: Bearer <ACCESS_TOKEN>

Functionality Details

The usersApi endpoint retrieves user details exclusively for users with the owner role. It returns a list of registered users' information, including their ID, username, email, role, and verification status.