Import API
The import API function allows you to import data from third-party meters into Energy Manager Online.
There are 2 ways to do this. The first option is to import the data via a CSV file by going into your account and navigating to 'Settings' > 'Import data', click here for more details.
The other way is to use the import API to send hourly readings directly to your account without logging in. The advantage of this is that you can create automated scripts to send readings straight to our software.How to use the import API
To send readings directly to your account, you must send a http get request in the following format:
http://www.enistic.com/static/import.php?unique_meter_ref=1234&year=2011&month=03&day=17&hour=00&
field_identifier=energy_delta&value=10&cost=1.1&co2=5.67&api_key=459a468f64397h84
The values in bold should be replaced with your values, the fields are explained below:


| Field | Explanation |
|---|---|
| unique_meter_ref | This is a unique reference that you can assign to each of your meters.It must be numeric and can be up to 12 digits long. When the data is imported, this reference number is prefixed with your account number to create a unique meter serial number. The meter will appear on the system as 'Imported meter' followed by your reference number. |
| year | This is the year that the reading was taken and must be in format 'YYYY' e.g. 2011. |
| month | This is the month that the reading was taken and must be in format 'MM' e.g. 12 for December. |
| day | This is the day that the reading was taken and must be in format 'DD' e.g. 12 for the 12th day of the month. |
| hour | This is the hour that the reading was taken and must be in format 'HH' e.g. 00 for 12am. |
| field_identifier |
There are 2 options you can use: 'energy_delta' or 'energy_cumulative'.
'energy_delta' is used for importing how much energy was used during that hour e.g. 11.01 kWh. 'energy_cumulative' is used for importing an aggregrated amount of energy used so far, e.g. 102 kWh has been used since the meter was installed. The system will then check the last record to calculate the delta value, therefore it is important to enter the data in chronological order. |
| value | The value is dependent on the field identifier you have chosen. For energy, the value is in kWh. |
| cost | Enter the cost incurred for the amount of energy used (leave as 0 if you do not know this value). |
| co2 | Enter the CO2 generated for the amount of energy used (leave as 0 if you do not know this value). |
| api_key | The API key is used to identify which account to link the meter to and to ensure that you are an authorised user. To find your API key, login to your account and go to 'Home' > 'Company preferences' and then the 'API' tab. API keys are unique to each account. |


For a meter to be linked to your account, it must be linked to a controller that is registered to your account, therefore you will see a new controller on your account called 'Virtual Controller'.
Example PHP script
The following PHP script can be used as a starting point for creating your own script. All you will need to change is how the values are retrieved from your existing third-party meters or software.
<?php
$unique_meter_ref = '1234'; // replace with your unique reference id, must be numeric and can be up to 12 digits long
$year = '2011'; // replace with the year the reading was taken 'YYYY'
$month = '03'; // replace with the month the reading was taken 'MM'
$day = '12'; // replace with the day the reading was taken 'DD'
$hour = '00'; // replace with the day the reading was taken 'HH' (24 hour clock)
$field_identifier = 'energy_delta'; // can be 'energy_delta' or 'energy_cumulative'
$value = '10.1'; // replace with energy value in kWh
$cost = '10.1'; // replace with cost value
$co2 = '5.6'; // replace with co2 value
$api_key = '459a468f64397h84'; // to find your API key, log in to your account and go to 'Home' > 'Company preferences'
and then to the 'API' tab
$ch = curl_init('http://www.enistic.com/static/import.php?unique_meter_ref=$unique_meter_ref&year=$year
&month=$month&day=$day&hour=$hour&field_identifier=$field_identifier&value=$value
&cost=$cost&co2=$cost&api_key=$api_key');
curl_exec ($ch);
curl_close ($ch);
?>


