Skip to content

Latest commit

 

History

History
184 lines (165 loc) · 3.04 KB

internalAPI.md

File metadata and controls

184 lines (165 loc) · 3.04 KB

Internal API

Those endpoints are designed to be user for communication between backend and frontend.

Authorization

Register

  • POST api/register
  • Input:
{
    "username": "string/email",
    "password": "string"
}

Login

  • Returns token required to access all endpoints (Authorization: Bearer)
  • POST api/login_check
  • Input:
{
    "username": "string",
    "password": "string"
}
  • Output:
{
    "token": "string/JWT Token",
    "refresh_token_expiration": "unix timestamp"
}

Devices

View

  • Get api/devices/{id}
  • Output:
{
    "id": "string/uuid",
    "name": "string",
    "active": "boolean",
    "shortId": "string",
    'password': 'string',
    "sensors": [
        {
            "id": "string/uuid",
            "name": "string",
            "active": "boolean"
        }
    ]
}

List

  • Returns list of user's active devices with active sensors
  • GET api/sensors
  • Output:
{
    "id": "string/uuid",
    "name": "string",
    "sensors": [
        {
            "id": "string/sensor uuid",
            "name": "string"
        }
    ]
}

Full list

  • Returns full list of user's devices with
  • GET api/sensors/full_list
  • Output:
[
    {
        "id": "string/uuid",
        "name": "string",
        "active": "boolean",
        "shortId": "string",
        "password": "string"
    }
]

Create

  • Changes device's name parameter
  • POST api/sensors
  • Input:
{
    "name": "string(25)"
}
  • Output:
[
    {
        "id": "string/uuid",
        "name": "string",
        "active": false,
        "shortId": "string",
        "password": "string",
        "sensors" : []
    }
]

Change active

  • Changes device's active parameter
  • GET api/sensors/{id}/change_active
  • Input:
{
    "active": "boolean"
}
  • Output:
[
    {
        "id": "string/uuid",
        "name": "string",
        "active": "boolean",
        "shortId": "string",
        "password": "string",
        "sensors" : [
            {
                "id": "string/sensor uuid",
                "name": "string",
                "active": "boolean"
            }
        ]
    }
]

Change name

  • Changes device's name parameter
  • GET api/sensors/{id}/change_name
  • Input:
{
    "name": "string(25)"
}
  • Output:
[
    {
        "id": "string/uuid",
        "name": "string",
        "active": "boolean",
        "shortId": "string",
        "password": "string",
        "sensors" : [
            {
                "id": "string/sensor uuid",
                "name": "string",
                "active": "boolean"
            }
        ]
    }
]