Wiki – Public API

[vc_row][vc_column][vc_empty_space height=”50px”][/vc_column][/vc_row][vc_row][vc_column][vc_wp_text]

Wattabit Public API

This page will provide to developers the information needed to obtain information from the Wattabit API. The audience is assumed to be technical and is required to have an understanding of HTTP, JSON and web services.

If after reading the documentation you still have questions please contact us at soporte@wattabit.com
[tp_blockquote author=”” link=”” target=”_blank” color=”#fff” background=”#ff004b” quote_color=”#d71951″ border_color=”#ff92b2″ author_color=”#fff” bottom_background=”#fb5988″ style=”1″] This API is dessigned for singular or periodic short data queries, but not for massive data transfer, for example machine learning purposes.
Wattabit S.L. reserves the right to apply queries restrictions and changes on the traffic limiting mechanism. Theses updates may be modified without notice as the system evolves in the future. Users can check in this documentation the latest interface updates.
[/tp_blockquote]

Index

¿How it works?

The service is an API REST web server accessible over HTTP/HTTPS

To obtain data from the service, follow the next steps:

    • Request and receive an API-Token: it is the mandatory security token to obtain information from the W-Manager API.
    • Fill the attributes in a JSON object and call a method of the Wattabit API to retrieve data

Authentication

login
Get session token, projects and plants lists

HEADER

A token must be sent in the request header in the following format:

“Authorization”:”Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c”

To obtain the token, the user must call the login with POST method and provide User and Password to the next URL:

URL

https://apiv2.wattabit.com/wthirdparty/v1/auth/login

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) User: username with an email format
    • (string) Password: user password

Response

{“token”: “{{token}}”,
“projectList”: [
{“id”: “{{project id}}”,
“name”: “{{project name}}”,
“plantsList”: [
{“id”: “{{plant id}}”,
“name”: “{{plant name}}”,
"timeZone": "{{plant timezone}}",
“identifier”: “{{plant identifier}}”}
]}
]
}

[tp_blockquote author=”” link=”” target=”_blank” color=”#fff” background=”#ff004b” quote_color=”#d71951″ border_color=”#ff92b2″ author_color=”#fff” bottom_background=”#fb5988″ style=”1″]Note: The Token will expire in 30 days.[/tp_blockquote]

Response Explanation
The response contains the “token” and a “projectList”, which is an array of objects with “id”, “name” and “plantsList”. A user can have access to one or several projects, each project contains a list of plants or installations:

loginlite
Get session token, projects list, to get the plant list by each project call GetPlantListByProject

HEADER
A token must be sent in the request header in the following format:
“Authorization”:”Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c”

To obtain the token, the user must call the login with POST method and provide User and Password to the next URL:

URL

https://apiv2.wattabit.com/wthirdparty/v1/auth/loginlite

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) User: username with an email format
    • (string) Password: user password

Response

{
“token”: “{{token}}”,
“projectList”: [
{“id”: “{{project id}}”,
“name”: “{{project name}}”
}
]
}

[tp_blockquote author=”” link=”” target=”_blank” color=”#fff” background=”#ff004b” quote_color=”#d71951″ border_color=”#ff92b2″ author_color=”#fff” bottom_background=”#fb5988″ style=”1″]Note: The Token will expire in 30 days.[/tp_blockquote]

Plants

GetPlantListByProject
Get plants list of a specific project

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetPlantListByProject

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project

Response:

[
{
“id”: “{{plant id}}”,
“name”: “{{plant name}}”,
"timeZone": "{{plant timezone}}",
“identifier”: “{{plant identifier}}”
}
]

GetPlantInfoByPlant
Get the information of a plant: name, address and technical information

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetPlantInfoByPlant

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project
    • (string) PlantId: Id of the plant

Response:

{
"id": "94a6acec-9ce9-4c41-b60e-4047eeb4b986",
"name": "Salou",
"identifier": "01",
"timeZone": "Romance Standard Time",
"address": "Carrer d'Hipòlit Lázaro, S/N, 43481 Platja de la Pineda, Tarragona, Spain",
"latitude": 41.0833173,
"longitude": 1.1722234,
"dataSheet": {
"EXCEDENTES": false,
"Paneles": "20 x 380W en suelo",
"Inversores": "3 x Inversor Sungrow",
"Potencia pico": 120,
"Orientación": 10,
"Inclinación": 25,
"Año construcción": 2022
}
}

GetPlantInfoByProject
Get the information of all the plants in a project: name, address and technical information

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetPlantInfoByProject

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project

Response:

[
{
"id": "94a6acec-9ce9-4c41-b60e-4047eeb4b986",
"name": "Salou",
"identifier": "01",
"timeZone": "Romance Standard Time",
"address": "Carrer d'Hipòlit Lázaro, S/N, 43481 Platja de la Pineda, Tarragona, Spain",
"latitude": 41.0833173,
"longitude": 1.1722234,
"dataSheet": {
"EXCEDENTES": false,
"Paneles": "20 x 380W en suelo",
"Inversores": "3 x Inversor Sungrow",
"Potencia pico": 120,
"Orientación": 10,
"Inclinación": 25,
"Año construcción": 2022
}
}
]

Monitoring Variables

GetMonitoringVarsByPlant
Get monitoring variables from a specific plant

To get the list of all variables from a specific plant.

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetMonitoringVarsByPlant

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project
    • (string) PlantId: Id of the plant

Response:

[
{
"supplyName": "Electricity",
"name": "General Consumption",
"units": "kWh",
"code": "CONS",
"id": "9abfd8fc-4be6-4c6a-9fcd-08465a6641f4",
"projectVarId": "a12b2401-9b6d-4f97-a3db-f9b05ab9cfa4"
},
{
"supplyName": "Solar production.Inverter A05J",
"name": " Inverter status ",
"code": "SOLAR_INVERTER_STATUS",
"id": "05c4a0d0-43fa-4a13-8743-7afa902d232e",
"projectVarId": ""
},
{
"supplyName": " Solar production.Inverter 603T",
"name": "Inverter status",
"code": "SOLAR_INVERTER_STATUS",
"id": "5932ed51-40f1-488d-a596-67a4825e4bb1",
"projectVarId": ""
},
{
"supplyName": "",
"name": "Solar Radiation",
"units": "W/m^2",
"code": "WEATHER_SOLAR_RAD",
"id": "189cb60c-ddd2-4b9b-81ad-5962d04da995",
"projectVarId": "b97ee73c-1451-4377-aafb-1db2247dbf8d"
}
]

The response is an array of all the variables monitored in the plant or installation. The structure of a plant and its variables is as follows:

  • variables can be organized in Supplies and Equipments, in each variable the attribute “supplyName” identifies the name of the Supply and the Equipment with this structure: {{supplyName}}.{{EquipmentName}}
  • In case that the Variables has not an assigned Equipment, the supplyName will be just {{supplyName}}
  • For those variables independent of a Supply, the supplyName will be an empty string

The “code” attribute represents the function of the variable in the platform, these are the most used codes by supply and equipment:

  • Supplies like Electricity, Gas or Water:
    • CONS: Consumption of the plant or installation (kWh)
    • POWER_ACT: The grid active power of the plant or installation, values will be negative when the plant injected to the grid (kW)
    • NET_POWER: The power of the plant coming from the grid, when energy is injected in the grid the values are 0 (kW)
    • SURPLUS_POWER: The power of the plant injected to the grid, when consuming from the grid values are 0 (kW)
    • SURPLUS: energy injected to the grid (kWh)
  • Solar production Supply:
    • PROD: Production of the plant (kWh)
    • SOLAR_INVERTER_POWER_AC: plant AC power (kW)
    • SELF_CONS: Self-consumed energy (kWh)
    • THEORETICAL_PROD: Production of the plant calculated by the platform (kWh)
    • BATTERY_SOC: all batteries state of charge average
    • BATTERY_CHARGE_ENERGY: total batteries charged energy (kWh)
    • BATTERY_DISCHARGE_ENERGY: total batteries discharged energy (kWh)
  • Inverter equipment:
    • PROD: Production of the inverter (kWh)
    • SOLAR_INVERTER_POWER_AC: inverter AC power (kW)
    • SOLAR_INVERTER_POWER_DC: inverter DC power (kW)
    • SOLAR_INVERTER_STATUS: inverter internal status
    • SOLAR_INVERTER_MPPT_PROD: MPPT DC energy. Contains the numeric ID of the MPPT i.e. (3) (kWh)
    • SOLAR_INVERTER_MPPT_P: MPPT DC power. Contains the numeric ID of the MPPT i.e. (3) (kW)
    • SOLAR_INVERTER_MPPT_I: MPPT intensity. Contains the numeric ID of the MPPT i.e. (3) (A)
    • SOLAR_INVERTER_MPPT_V: MPPT voltage. Contains the numeric ID of the MPPT i.e. (3) (V)
  • Battery equipment:
    • BATTERY_SOC: all batteries state of charge average
    • BATTERY_CHARGE_ENERGY: total batteries charged energy (kWh)
    • BATTERY_DISCHARGE_ENERGY: total batteries discharged energy (kWh)
  • Independent variables:
    • WEATHER_TEMP: environment temperature where plant is located (ºC)
    • WEATHER_RH: environment relative humidity where plant is located (%)
    • WEATHER_SOLAR_RAD: environment solar radiation where plant is located (W/m2)

The “projectVarId” attribute represents common id of the variable in the entire project, this attribute is only for common variables, not for plant specific variables.

GetProjectMonitoringVars
Get common monitoring variables in a project

To get the list of all common variables in a project, like total consumption or production, but specific variables like an inverter power will not appear in this result.

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetProjectMonitoringVars

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project

Response:


[{
{
"supplyName": "Electricity",
"name": "General Consumption",
"units": "kWh",
"code": "CONS",
"id": "78f589e9-ac91-444a-82e0-fc542b5cad1c"
},
{
"supplyName": "",
"name": "Solar Radiation",
"units": "W/m^2",
"code": "WEATHER_SOLAR_RAD",
"id": "cd23afd9-7f91-4cec-a682-bd9649933a8b"
}
}]

Response Explanation

The response is an array of all the common variables monitored in all the plants of the project.

ActivateInstallation
Add a PV installation to the platform with the manufacturer API data

The API devices should be sending data and assigned to the project where the activation will be performed.

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/ActivateInstallation

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project
    • (string) ManufacturerId: Id of the installation in the manufacturer API (number or Guid). But the parameter should be string. Examples:
      • HUAWEI: “NE=139505916“, for old installations the format could be with more numbers: “22560789D46D495F97177E02B9F74191
      • SUNGROW: “5451184″
      • FRONIUS: “116e1c13-0f9e-42f6-9f83-e079e6b525e9″
      • SOLAR_EDGE: “4156063″
      • SMA: “1b848145-7f78-433c-832f-f95ef0b6ed1b”
    • (int) DataProvider: Id number of the manufacturer in W-Manager
      • HUAWEI: 51
      • SUNGROW: 52
      • FRONIUS: 55
      • SOLAR_EDGE: 64
      • SMA: 60

Response:


{
"id": "{{plant id}}",
"name": "{{plant name}}",
"identifier": "{{plant identifier}}",
"timeZone": "{{plant timezone}}"
}

Monitoring Values

MonitoringDataByPlant
Get monitoring data

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/MonitoringDataByPlant

BODY

Method: POST
List of accepted parameters:

      • Mandatory:
        • (string) ProjectId: Id of the project
        • (string) PlantId: Id of the plant
        • (string) ParameterId: Id of the variable obtained in the “GetMonitoringVarsByPlant” request
        • (int) Granularity: 0 = RAW (how data arrived to the database, without filters and operations), 1 = 5 minutes, 2 = Quarterhourly, 3 = Hourly, 4 = Daily, 5 = Monthly
        • (string) Start: Start date (plant local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)
        • (string) End: End date (plant local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)

POST body:

{
“ProjectId”: “58667e3d-bc2e-4876-a9de-afaf00ba4aa2”,
“PlantId”: “fe9cda5a-4ae8-48f5-8401-b00300b96390”,
“ParameterId”: “e2e0e498-d8d0-4b65-b39d-c6d7fd63238e”,
“Granularity”: 3,
“Start”: “2024-07-04T13:00:00”,
“End”: “2024-07-04T14:00:00”
}


Restrictions:

      • The maximum period of the request is 1 month

Response:


[
{
"plantId": "21652d4e-b445-4fc3-ab77-a5bc00d234cb",
"values":
[
{ "value": 1574, "time": "2018-02-10T00:00:00"},
{ "value": 1516, "time": "2018-02-11T00:00:00"}
]
}
]

Response Explanation

Array of time-values and the “plantId”.
Times are in the local time of the plant.

MonitoringDataByProject
Get monitoring data

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/MonitoringDataByProject

BODY

Method: POST
List of accepted parameters:

  • Mandatory:
    • (string) ProjectId: Id of the project
    • (string) ParameterId: Id of the variable obtained in the “GetProjectMonitoringVars” request
    • (int) Granularity: 0 = RAW (how data arrived to the database, without filters and operations), 1 = 5 minutes, 2 = Quarterhourly, 3 = Hourly, 4 = Daily, 5 = Monthly
    • (string) Start: Start date (plants local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)
    • (string) End: End date (plants local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)
  • Optional:
    • (string array) Plants: array of plant Ids, use this parameter to get the data from a list of plants, otherwise do not provide it to obtain the data from all plants

POST body:


{
"ProjectId": "58667e3d-bc2e-4876-a9de-afaf00ba4aa2",
"ParameterId": "e2e0e498-d8d0-4b65-b39d-c6d7fd63238e",
"Granularity": 3,
"Start": "2024-07-04T13:00:00",
"End": "2024-07-04T14:00:00"
}


Restrictions:

      • The maximum period of the request is 7 days for 100 plants, and 1 day for more plants

Response:


[
{
"plantId": "21652d4e-b445-4fc3-ab77-a5bc00d234cb",
"values":
[
{ "value": 1574, "time": "2018-02-10T00:00:00"},
{ "value": 1516, "time": "2018-02-11T00:00:00"}
]
}
]

Response Explanation

Array of time-values and the “plantId”.
Times are in the local time of the plant.

Alarms

GetAlarmsByPlant
Get alarms from a specific plant

To get the list of the alarms launched in a specific plant

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetAlarmsByPlant

BODY

Method: POST
List of accepted parameters:

      • Mandatory:
        • (string) ProjectId: Id of the project
        • (string) PlantId: Id of the plant
        • (string) Start: Start date (plant local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)
        • (string) End: End date (plant local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)

Response:

Parameters and response dates are in local date of the plant

The alarms status are 3:

      • PENDING: the alarm condition has been met and the system has generated this alarm, if the alarm has automatic resolution, means that the condition is still true, otherwise if the alarm has manual resolution means that the maintenance user has still not changed the status
      • INPROGRESS: the maintenance user has changed the status to In progress
      • SOLVED: if the alarm has automatic resolution, means that the alarm condition is not true anymore, otherwise if the alarm has manual resolution means that the maintenance user has changed the status

[
{
"id": "cff48410-9400-4215-b9e9-b10700d91218",
"plantId": "b9fdcb8f-363b-401c-aa85-afdb00cd16c2",
"name": "Alarma de producción 0 en Inversor",
"description": "[Fotovoltaica][Inversor 100KTL] Potencia AC <= 0",
"status": "SOLVED",
"registrationDate": "2024-01-30T14:00:00",
"resolutionDate": "2024-01-31T08:30:00"
}
]

GetAlarmsByProject

To get the list of the alarms launched in all the plants from a project

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/GetAlarmsByProject

BODY

Method: POST
List of accepted parameters:

      • Mandatory:
        • (string) ProjectId: Id of the project
        • (string) Start: Start date (plants local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)
        • (string) End: End date (plants local date) for the query (ISO format YYYY-MM-ddTHH:00:00 where minutes and seconds must be 0)

Response:

Parameters and response dates are in local date of the plant

The alarms status are 3:

      • PENDING: the alarm condition has been met and the system has generated this alarm, if the alarm has automatic resolution, means that the condition is still true, otherwise if the alarm has manual resolution means that the maintenance user has still not changed the status
      • INPROGRESS: the maintenance user has changed the status to In progress
      • SOLVED: if the alarm has automatic resolution, means that the alarm condition is not true anymore, otherwise if the alarm has manual resolution means that the maintenance user has changed the status

[
{"id": "cff48410-9400-4215-b9e9-b10700d91218",
"plantId": "b9fdcb8f-363b-401c-aa85-afdb00cd16c2",
"name": "Alarma de producción 0 en Inversor",
"description": "[Fotovoltaica][Inversor 100KTL] Potencia AC <= 0",
"status": "SOLVED",
"registrationDate": "2024-01-30T14:00:00",
"resolutionDate": "2024-01-31T08:30:00"
}]

Push data

PublishManual
Publish new data to a manual datalogger

Only works with manufacturer Manual, the datalogger should be created previously. Devices and variables within the datalogger are created automatically if they don’t exist.

URL

https://apiv2.wattabit.com/wthirdparty/v1/data/PublishManual

BODY

Method: POST
List of accepted parameters:

      • Mandatory:
        • (string) dataloggerId: Id of the Manual datalogger, for example “MANUAL_DL1”
        • (array of objects) data: object with 4 attributes
          • (string) datetime: date for the value (UTC date in ISO format YYYY-MM-ddTHH:mm:ss)
          • (string) dev: device Id in the datalogger
          • (string) var: variable Id in the device
          • (float) value: value with decimals

POST Example

{
"dataloggerId": "MANUAL_DL1",
"data":[
{
"datetime": "2024-03-19T23:00:00",
"dev": "deviceId",
"var": "variableId",
"value": 1.0
}
]
}
[/vc_wp_text][/vc_column][/vc_row]

Scroll to Top