pinStatusApi - n1lby73/industrial-IOT GitHub Wiki

Overview

The Pin Status API endpoint retrieves and returns the current state of a microcontroller pin form the database. It requires authentication through a JSON Web Token (JWT) and provides information about the status of the specified pin.

Endpoint URL

  • URL: https://industrialiot.onrender.com/api/status
  • Method:POST

Request Parameters

  • Headers:
    • Authorization: Bearer <ACCESS_TOKEN>
    • Content-Type: application/json
Parameter Type Description
pin Integer Pin number (required)

Responses

  • Success Response:

    • Status Code: 200 OK
    • Response Body:
      {
        "motor state": "<PIN_STATE>"
      }
      • Description: Indicates the state of the specified pin retrieved successfully.
  • Error Responses:

    • Status Code: 400 Bad Request

      • Response Body:
        {
          "error": "invalid pin"
        }
      • Description: Indicates an invalid or unrecognized pin number provided.
    • Status Code: 503 service unavailable

    • Response Body:

      {
        "Alert": "ESP is offline. Current state unknown"
      }
      • Description: Indicates that the ESP is offline, and the current state of the device is unknown.

Usage

  1. Request Method: POST

  2. Endpoint URL: https://industrialiot.onrender.com/api/status

  3. Header:

    Authorization: Bearer <JWT>
    Content-Type: application/json
  4. Request Body:

    {
      "pin": 26
    }

Additional Information

  • For details on consumed pins and functions, check here.
  • For more error message and causes, check here.
⚠️ **GitHub.com Fallback** ⚠️