Skip to content

addDevice (Template)

Stores a new device in the database. This API is used to add new devices along with their name, MAC address, and status.

Request

The API expects a POST request with the following parameters:

Parameter Type Description
deviceName String The name of the device.
deviceMacAddress String The MAC address of the device.
deviceStatus String The status of the device.

Response

Content-Type: application/json

The API responds with a JSON object containing the following fields:

Name Type Description
success boolean Indicates if the device was added successfully.
message string Describes the result or error message.

Example

Example Request

POST /php/addDevice.php
Content-Type: application/x-www-form-urlencoded

deviceName={deviceName}&deviceMacAdress={deviceMacAdress}&deviceStatus={deviceStatus}

Successful Response

{
    "success": true,
    "message": "Added device: [Device Name] successfully"
}

Failed Response

{
    "success": false,
    "message": "Error: [Error message]"
}