# info.description
API  allows customers to obtain data from their units using HTTP methods, such as GET, POST, PUT, and DELETE. REST API is easy to use and scalable, allowing customers to obtain data from units in near real-time. Depending on WSV refresh period.

# paths./{loginId}/units.get.description
Returns list of all units under your account

# paths./{loginId}/units.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units.get.responses.200.description
Returns list of all units under your Websupervisor account in JSON format in the body of the response

Response values:
count: the number of Units registered under the Websupervisor account. (number)
units: field of Units registered under Websupervisor account. (field)
name: name of the Unit, same as in Websupervisor. (string)
unitGuid: unique static identification of the Unit. (string)
url: URL address, where basic info of the Unit is accessible. (string)

# paths./{loginId}/units.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/values.get.parameters[].description
Unique value identifier (accept multiple guids separated by commas). Leave blank to show all possible values in the Unit

# paths./{loginId}/units/{unitGuid}/values.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/values.get.responses.200.description
Returns all/selected values from the Unit
Response values:
name: name of the Unit, same as in Websupervisor. (string)
unitGuid: unique static identification of the Unit. (string)
values: field of the Unit values (field)
name: name of the value, same as in Websupervisor. (string)
valueGuid: unique static identification of the value. (string)
value: current value. Can be a list of values if applicable. (string)
unit: the physical units. (string)
highLimit: value high limit configured in the Websupervisor. Just for values, where it is applicable. (number)
lowLimit: value low limit configured in the Websupervisor. Just for values, where it is applicable. (number)
decimalPlaces: decimal places of the value. (number)
timeStamp: the timestamp, when the value has been read from the Unit. (string)

# paths./{loginId}/units/{unitGuid}/values.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/values.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/info.get.description
Returns basic information about the unit

# paths./{loginId}/units/{unitGuid}/info.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/info.get.responses.200.description
Returns basic information about the unit
Response values:
name: name of the Unit, same as in Websupervisor. (string)
unitGuid: unique static identification of the Unit. (string)
ownerLoginId: account with owner status configured in the Unit. (string)
applicationType: application type configured in the Unit. (string)
timezone: timezone configured in the Unit. (string)
connection: list of values related to the Unit network connection. (field)
enabled: network connection is enabled/disabled. true/false (boolean)
airGateId: ID of connection trought Airtgate service. (string)
ipAddress: IP address of the Unit network interface. (string)
port: used TCP port. (number)
controllerAddress: Address of controller configured in the Unit. (number)
position: list of values related to the Unit configured position. (field)
positionType: type of configured position of the Unit. (string)
latitude: geographical position - latitude. (string)
longtitude: geographical position - longtitude. (string)

# paths./{loginId}/units/{unitGuid}/info.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/info.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/permissions.get.description
List of Unit users with their permissions

# paths./{loginId}/units/{unitGuid}/permissions.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/permissions.get.responses.200.description
Returns list of all users with some rights to the unit
Response values:
name: name of the Unit, same as in Websupervisor. (string)
unitGuid: unique static identification of the Unit. (string)
permisions: field of the users and their permissions top the Unit (field)
loginId: the login name. (string)
read: User can read values. true/false. (boolean)
control: User can control the Unit. true/false.. (boolean)
modify User can change settings of the Unit. true/false (boolean)
shutdownNote User can do shutdown Notes. (boolean)
allAlarmsNote: User can do alarm Notes. (boolean)

# paths./{loginId}/units/{unitGuid}/permissions.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/permissions.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/history.get.description
Returns historical values of unit (e.g. RPM…)
In case of request for bigger amout of data, it has to be split into several requests and use sequential data read. For this purpose requests contain attribute offset. Response has attribute nextOffset. Limit for one response is 200 kB.
Caution: Data in the response are formatted as, that only changes in value are stored. In response you obtain the value and from/to the period when it was valid. For timeline applications, you have to parse data in the application.

# paths./{loginId}/units/{unitGuid}/history.get.parameters[].description
History is provided from this date, default value is first day in actual month, format MM/DD/YYYY

# paths./{loginId}/units/{unitGuid}/history.get.parameters[].description
History is provided until this date, default value is time of the query, format MM/DD/YYYY

# paths./{loginId}/units/{unitGuid}/history.get.parameters[].description
Offset address for the next batch of values, default value is 0

# paths./{loginId}/units/{unitGuid}/history.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/history.get.responses.200.description
Returns list of historical values
Response values:
name: name of the Unit, same as in Websupervisor. (string)
unitGuid: unique static identification of the Unit. (string)
nextOffset: address to obtain the next batch of data. Should be used in the offset parameter in the request. "null" if there is no next batch (number)
values: list of the historical values with period of validity. (field)
name: name of the value, same as in the Websupervisor. (string)
valueGuid: unique static identifier of the value. (string)
history: list of the historical values with a period of validity. (field)
value: valid value in the period. (type depends on the value)
validFrom: value valid from. (string)
validTo: value valid to. (string)

# paths./{loginId}/units/{unitGuid}/history.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/history.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/command.post.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/command.post.requestBody.description
## List of all available commands: 
- #### start
- #### stop
- #### faultReset
- #### changeMcb
    - toggle Mains circuit breaker
- #### changeGcb
    - toggle Genset circuit breaker
- #### sensorButton
    - supported only by special branch of controllers
- #### timerButton
    - supported only by special branch of controllers
- #### changeMode
    - requires attribute "mode" - string representing mode e.g. off, man, aut, test
        - for list of available modes for particular controller model check the value 49424e2b-1009-471c-b8e3-3e84e9c16159
- #### userButton
    - requires attribute "index" - number to identify user button (1-32)
    - requires attribute "action" - string representing action ("start", "stop", "toggle", "pulse")
- #### remoteSwitch
    - requires attribute "index" - number to identify remote switch (1-8)
    - requires attribute "action" - string representing action ("start", "stop")
- #### extValue
    - requires attribute "index" - number to identify external value (1-4)
    - requires attribute "value" - numerical value written to selected external value
- #### setTimer
    - requires attribute "index" - number to identify timer (1-2)
    - requires attribute "action" - json object with timer settings
- #### changeSetpoint
    - requires attribute "guid" - guid to identify setpoint
    - requires attribute "value" - numerical value or string to selected setpoint, **string values are case sensitive**

### JSON object for timer settings:
- requires attribute "mode" - string representing timer settings ("Off", "Once", "Daily", "Weekly", "Monthly", "MonthlyDays", "Period")
    - for "mode": "**Off**"
        - no attribute
    - for "mode": "**Once**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
    - for "mode": "**Daily**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
        - requires attribute "setupDaily" - json object with timer settings
            - requires attribute "dayRepeat" - number, repeat every x. day
            - requires attribute "dayWeekend" - string, how to handle weekends ("Included", "Except", "nextDayAfter")
    - for "mode": "**Weekly**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
        - requires attribute "setupWeekly" - json object with timer settings
            - requires attribute "weekRepeat" - number, repeat every x. week
            - requires attribute "weekDays" - string array, select day/s when execute ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
    - for "mode": "**Monthly**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
        - requires attribute "setupMonthly" - json object with timer settings
            - requires attribute "monthRepeat" - number, repeat every x. month
            - requires attribute "dayInMonth" - number, repeat every x. day in month
    - for "mode": "**MonthlyDays**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
        - requires attribute "setupMonthlyDays" - json object with timer settings
            - requires attribute "monthRepeat" - number, repeat every x. month
            - requires attribute "weekInMonth" - number, repeat every x. week in month
            - requires attribute "weekDays" - string array, select day/s when execute ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
    - for "mode": "**Period**"
        - requires attribute "from" - number, timer first occurance, UNIX epoch time in miliseconds
        - requires attribute "duration" - number, timer duration in minutes
        - requires attribute "setupPeriod" - json object with timer settings
            - requires attribute "minutesRepeat" - number, repeat every x minutes


           

# paths./{loginId}/units/{unitGuid}/command.post.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/command.post.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/comments.get.description
Returns comments posted on unit's detail view screen

# paths./{loginId}/units/{unitGuid}/comments.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/comments.get.responses.200.description
Returns array of all comments posted on unit's detail view screen
Response values:
unitGuid: unique static identification of the Unit. (string)
comments: list of comments posted on unit's detail view screen. (field)
id: ID of the comment. (number)
author: type of the file. (string)
date: timestamp when comment was created. (string)
text: message in the comment. (string)
active: status of comment. true/false. (boolean)

# paths./{loginId}/units/{unitGuid}/comments.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/comments.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/units/{unitGuid}/files.get.description
Returns list of all available files stored in the the unit.

# paths./{loginId}/units/{unitGuid}/files.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/units/{unitGuid}/files.get.responses.200.description
Returns list of all files stored in the unit
Response values:
unitGuid: unique static identification of the Unit. (string)
files: list of files available in the Unit. (field)
fileName: name of the file. (string)
fileType: type of the file. (string)
generated: timestamp when file was created. (string)

# paths./{loginId}/units/{unitGuid}/files.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/units/{unitGuid}/files.get.responses.401.description
Response when incorrect or expired token is provided

# paths./{loginId}/unit/{unitGuid}/download/{fileName}.get.description
Returns file containing controller history or WSV report.

# paths./{loginId}/unit/{unitGuid}/download/{fileName}.get.parameters[].description
Header for token type + access token, i.e. "Bearer asd....fg12"

# paths./{loginId}/unit/{unitGuid}/download/{fileName}.get.responses.400.description
Response when incorrect unitGuid is provided

# paths./{loginId}/unit/{unitGuid}/download/{fileName}.get.responses.401.description
Response when incorrect or expired token is provided