# Appendices

# Plexus nomenclature criteria

The text fields to be filled in respecting the nomenclature criteria these criteria are only alphanumeric characters [0-9, a-z, A-Z] and a few symbols [-, _]. Punctuation marks, spaces, single quotes and double quotes, slashes and backslashes, parentheses and mathematical symbols are prohibited.

More details on API Functions and variables here

# Bridge mode API REST

The responding URL is http://<HOST>/plexus/api/api.php; it accepts both GET and POST methods, for your convenience.

# Parameter list

Parameter name Mandatory Type Info
psw check string The API / Bridge password
read clear array of string When used, the requested values will be included inside the response
write clear array of tuple string-value When used, the values will be written into the system
alarms_log clear string = "list" When used, the alerts message list will be included inside the response

Warning

  • "read" parameter can include device channels, section variables or timers, and alerts;
  • "write" parameter can include device channel names, section variables and alerts; timers are not supported yet

Hint

For a list of all the system device channels, section variables or timers, and alerts, you can navigate to http://<HOST>/plexus/pages/data_table.php

# Response structure

A JSON response will be provided, in the following form:

{
  "error": 0,
  "response": {
    "system": "OK",
    "alarms_log": {     // this field appears only if the request contains the "alarms_log" field with value "list"
      "63637f931523d": {
        "message": "A sensor is broken, please replace it",
        "triggered": 1667465107.086585,
        "alert_name": "Faulty_sensor",
        "element_id": "res",
        "duration": "ACTIVE",
        "rand_id": "63637f931523d",
        "email": 1
      }
    },
    "read": {           // this field appears only if the request contains the "read" field
      "Variable_1": 77,
      "Variable_2": 44
    },
    "write": "OK"       // this field appears only if the request contains the "write" field
  }
}
api_bridge_response
POST request example, made with Postman software

# Example using GET method

curl --location -g --request GET 'http://localhost/plexus/api/api.php?json={"psw": "93gy6w1v", "read": ["Sensor_1", "Sensor_2"], "write": {"EV_1": 1}}'

Notice

The parameters structure described above must be formatted as a JSON string and passed as a unique query string parameter called "json"

# Example using POST method

curl --location --request POST 'http://localhost/plexus/api/api.php' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'psw=93gy6w1v' \
--data-urlencode 'read[]=Variable_1' \
--data-urlencode 'read[]=Variable_2' \
--data-urlencode 'write[Variable_3]=5' \
--data-urlencode 'alarms_log=list'

Notice

Content-Type must be 'application/x-www-form-urlencoded'

Last Updated: 2/2/2024, 4:28:31 PM