NAV
Command Line Ruby Python PHP Perl Java NodeJS Javascript

Introduction

Welcome to the EKM METERING API!

We at EKM see easy access to your data, and the scalable systems behind the EKM Push, as crucial to moving our products into the future. To that end, we do what is unheard of in our industry, we give you your data for FREE.

The EKM API is organized around Representational State Transfer, or REST. You can use our Application Programming Interface, or API, to access EKM API endpoints, which can get you information on various EKM Push meter/ioStack data and utilize it in your own application, database, billing system, or building automation system.

We have language bindings in Shell (cURL), Ruby, Python, PHP, Perl, Java, Javascript and Nodejs! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your secret EKM Push API key in any public website’s client-side code). JSON will be returned in all responses from the API, including errors (though if you’re using API bindings, we will convert the response to the appropriate language-specific object).

Authentication

To authorize, make sure to use your personal EKM Push account key.

The examples in this API documentation use the demo key of MTAxMDoyMDIw. Please make sure you remove this key and place your personal key in the https address if you are trying to access the meters in your account.

With shell, you can just pass the correct address with each request
curl -s "URL Here"
Authorization: "EKM Push Key"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("URL Here#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include for example https://summary.ekmpush.com
api_object = call_api('URI Here')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''
    Make http request
    '''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("URL Here")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('URL Here');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>    
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api('URL Here');

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONObject callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONObject(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("URL Here");

        /*
         You can access any part of the apiObject using code like this:
         JSONArray  readData = apiObject.getJSONObject("readmeter").getJSONArray("ReadSet").
         getJSONObject(0).getJSONArray("ReadData");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the 
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('URL Here',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work 
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

// Load modules
const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'URL Here',
  timeout: 1000 * 15,
})

// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('URI Here');
    const apiResData = res.data;

    console.log(JSON.stringify(apiResData, null, 2));
  } catch (error) {
    console.error(error.message);
  }
})();

Make sure to replace the sample key: MTAxMDoyMDIw, with your API key in the https address.

EKM uses API keys to allow access to the API. You authenticate to the EKM API by providing one of your unique API keys in each request. Each Push account holder is provided with an EKM Push User Key, which provides access to all meters in their account. This key carries lots of privileges so we encourage you to keep it secret. In addition to this master key, additional keys are also provided to give access to each meter/ioStack individually, and keys can be created to provide access to sub groups of meters/ioStacks upon request. These secondary keys can be used to share single meters/ioStacks, or a subset of meters/ioStacks, without sharing access to all meters/ioStacks in an account. For example, if you are a landlord with multiple rentals and meters/ioStacks, you could share specific meter/ioStack keys with each of your tenants, so that they could have access to only the data that pertains to their usage.

Authentication to the API occurs via HTTP Basic Auth. Provide your API key as the basic authorized username. You do not need to provide a password. You must authenticate for all requests.

The EKM Push API expects the API key to be included in all requests to the server. The key is included in the URL in the following way:

Authorization: key=MTAxMDoyMDIw

Realtime API

Click here to go to Realtime Documentation

If you are developing your own app, cloud-to-cloud solution, billing system, or other SAS solution, our Real-Time API allows you to easily access your EKM Push data in any format that you need. Below you will find descriptions regarding how to access the data, and about the filters you can apply so the data comes to you in a format that is easily digested and inserted into your software solution.

The real-time API provides the 1,000 latest meter readings for each of your meters/IOStack devices. If your device is being read once per minute, the data will be made available once per minute, per device. Whether you have one device or 10,000 devices, this is the easiest and most scalable way to access your data.

The EKM Dash, EKM Widget, encompass.io, wattvision.com, pvoutput.org, the other solutions in our Push App Store, as well as other customers that have their own custom solutions, all use this API to access their data. We use the same API as you and do not give ourselves any special permissions, we see what you see, which forces us to make the API as great as possible for everyone. We have even given you code examples that can be copy and pasted into your own software language to make the data access that much easier.

Use the API definition, metered values definition, code snippet suggestion, and guide to get you on your way to developing your next killer app. If you create something great, let us know; we’re open to adding all useful apps into the Push App Store.

We also have a Realtime API Request Builder Tool found here:

Realtime API Builder

Account API

Click here to go to Account API Documentation

This API provides information for accounts and devices owned by the account.

Get information for the specified target, which can be account, gateway, meter or ioStack.

You could make API request with the EKM Push Key that is your own Authorization Key that you received for your Push Account, or instead the EKM Push Key you could use Gateway Key for more restricted access. Be aware that if you use the Gateway Key, you will only receive information regards to that gateway.

Gateway Settings API

Click here to go to Gateway Settings API Documentation

This API is used to send commands and settings to devices connected to a Push3 gateway as well as the gateway device itself.

Trigger API

Click here to go to Trigger API Documentation

A REST API to lookup/create/update/delete triggers.

EKM Push3 gateway triggers are among the most powerful tools that EKM offers. You can automate how and when the EKM Push system reacts to metered values. For example, you can have the Push gateway send you an email, send a webhook to your server, or control a relay to turn on/off a switch or close a valve based on the metered data. Push3 gateways can trigger specific actions based on conditions you set up. These triggers reside on the Push3 gateways, allowing them to function even without an internet connection. Triggers can control the relays on v.4 Omnimeters to turn devices on or off, send webhooks to alert your software system, or email you notifications. You can set up new triggers in the Account Portal or via web APIs.

Please note: v.3 Omnimeters do not have controllable relays, so relay triggers will not work, but email triggers will.

Summary API [Legacy]

Our Summary API captures real-time data readings and stores this information to create a comprehensive historical dataset for each meter. Data is stored over 15 minute time periods, and summarizes them into single 15 minute summaries. We keep 15-minute summaries for 2 years (all timezones), hourly summaries for 4 years (a 1-hour sample for all full-hour offset timezones, and only a 15-minute sample for each hour for 30- and 45-minute offset timezones), daily summaries for 6 years (UTC timezone only), weekly summaries for 8 years (UTC only), and monthly summaries for 10 years (UTC only). Our system can then combine these summaries together to summarize hours, days, weeks, and months. This dataset is often the best way to get historical values like kWh, pulse counts, etc. It also provides averages, min. and max. values, difference, and more. We make this data available to you via our Summary API in a very similar way to our Real-Time API.

You can use the Summary API definition to access the data you need, from 15 minutes to years of data. We have gone to great lengths to provide this data for free in order to add value to our metering systems. The Summary API, the Real-Time API, great affordable hardware, and scalable access to your data are all components of the most powerful, and highest value metering system available in the world.

We also have an API Builder Tool found here: API Builder

HTTPS Request

Summary API request example

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

# This example digs deeper into the JSON and displays the first
# kwh_tot_max value for the first summary read
summary = api_object[0]
kwh_tot_max = summary['kWh_Tot_Max']
pp "kWh_Tot_Max: #{kwh_tot_max}"

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

# This example digs deeper into the JSON and displays the first
# kwh_tot_max value for the first summary read
summary = api_object[0]
kwh_tot_max = summary['kWh_Tot_Max']
print("kWh_Tot_Max: ", kwh_tot_max)
<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);


// This example digs deeper into the JSON and displays the first
// kwh_tot_max value for the first summary read
$summary = $apiObject[0];
$kwh_tot_max = $summary->kWh_Tot_Max;
echo "kWh_Tot_Max: $kwh_tot_max";


// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

# This example digs deeper into the JSON and displays the first
# kwh_tot_max value for the first summary read
my $summary     = $api_object->[0];
my $kwh_tot_max = $summary->{kWh_Tot_Max};

print "kWh_Tot_Max: $kwh_tot_max";    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        // Call the callApi function to create a usable
        // object named apiObject from the API request URL.
        // Put the API request URL in the call
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*");

        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        System.out.println(apiObject.toString(4));

        // This example digs deeper into the JSON and displays the first
        // kwh_tot_max value for the first summary read
        JSONObject summary = apiObject.getJSONObject(0);
        Object kwhTotMax = summary.get("kWh_Tot_Max");
        System.out.println("kWh_Tot_Max: " + kwhTotMax);
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*',function(apiObject){
      //document.getElementById("result2").innerHTML = "<pre>hello</pre>"; 
      // This just displays the object in the result div
      // you can use what ever code you would like to work
      // with the object here
      document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";

      // This example digs deeper into the JSON and displays the first
      // kwh_tot_max value for the first summary read
      summary = apiObject[0];
      kwh_tot_max = summary["kWh_Tot_Max"];
      document.getElementById("kwh_tot_max").innerHTML = "<pre>kWh_Tot_Max: "+kwh_tot_max+"</pre>"; 
    });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"> </div>
    <div id="kwh_tot_max"> </div>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=1&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);

    // This example digs deeper into the JSON and displays the
    // kwh_tot_max value for the first summary read
    const summary = apiResData[0];
    const kwhTotMax = summary.kWh_Tot_Max;
    console.log(`kWhTotMax: ${kwhTotMax}`);
  } catch (error) {
    console.error(error.message);
  }
})();

The above example returns the following results:

[
   {
      "Start_Time_Stamp_UTC_ms": 1649353501837,
      "End_Time_Stamp_UTC_ms": 1649354342015,
      "End_Date": "Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)",
      "Start_Date": "Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)",
      "Meter": 17507,
      "Protocol": "v3",
      "Count": 15,
      "rejected_bad": 0,
      "rejected_duplicates": 0,
      "kWh_Tot_DeltaMin": 0,
      "kWh_Tot_DeltaMax": 0.1,
      "kWh_Tot_Min": 50811.7,
      "kWh_Tot_Max": 50812.4,
      "kWh_Tot_Diff": 0.7
   }
]

[{"Start_Time_Stamp_UTC_ms"=>1649353501837,
  "End_Time_Stamp_UTC_ms"=>1649354342015,
  "End_Date"=>"Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)",
  "Start_Date"=>"Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)",
  "Meter"=>17507,
  "Protocol"=>"v3",
  "Count"=>15,
  "rejected_bad"=>0,
  "rejected_duplicates"=>0,
  "kWh_Tot_DeltaMin"=>0,
  "kWh_Tot_DeltaMax"=>0.1,
  "kWh_Tot_Min"=>50811.7,
  "kWh_Tot_Max"=>50812.4,
  "kWh_Tot_Diff"=>0.7
}]
"kWhTotMax: 50812.4"


[{'Count': 15,
  'End_Date': 'Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)',
  'End_Time_Stamp_UTC_ms': 1649354342015,
  'Meter': 17507,
  'Protocol': 'v3',
  'Start_Date': 'Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)',
  'Start_Time_Stamp_UTC_ms': 1649353501837,
  'kWh_Tot_DeltaMax': 0.1,
  'kWh_Tot_DeltaMin': 0,
  'kWh_Tot_Diff': 0.7,
  'kWh_Tot_Max': 50812.4,
  'kWh_Tot_Min': 50811.7,
  'rejected_bad': 0,
  'rejected_duplicates': 0}]
kWh_Tot_Max:  50812.4

array(1) {
  [0]=>
  object(stdClass)#1 (14) {
    ["Start_Time_Stamp_UTC_ms"]=>
    int(1649353501837)
    ["End_Time_Stamp_UTC_ms"]=>
    int(1649354342015)
    ["End_Date"]=>
    string(39) "Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)"
    ["Start_Date"]=>
    string(39) "Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)"
    ["Meter"]=>
    int(17507)
    ["Protocol"]=>
    string(2) "v3"
    ["Count"]=>
    int(15)
    ["rejected_bad"]=>
    int(0)
    ["rejected_duplicates"]=>
    int(0)
    ["kWh_Tot_DeltaMin"]=>
    int(0)
    ["kWh_Tot_DeltaMax"]=>
    float(0.1)
    ["kWh_Tot_Min"]=>
    float(50811.7)
    ["kWh_Tot_Max"]=>
    float(50812.4)
    ["kWh_Tot_Diff"]=>
    float(0.7)
  }
}
kWh_Tot_Max: 50812.4
$VAR1 = [
          {
            'Start_Time_Stamp_UTC_ms' => '1649353501837',
            'End_Time_Stamp_UTC_ms' => '1649354342015',
            'End_Date' => 'Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)',
            'Start_Date' => 'Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)',
            'Meter' => 17507,
            'Protocol' => 'v3',
            'Count' => 15,
            'rejected_bad' => 0,
            'rejected_duplicates' => 0,
            'kWh_Tot_DeltaMin' => 0,
            'kWh_Tot_DeltaMax' => '0.1',
            'kWh_Tot_Min' => '50811.7',            
            'kWh_Tot_Max' => '50812.4',
            'kWh_Tot_Diff' => '0.7',            
          }
        ];
kWh_Tot_Max: 50812.4

[{
    "kWh_Tot_DeltaMin": 0,
    "kWh_Tot_Min": 50811.7,
    "Start_Time_Stamp_UTC_ms": 1649353501837,
    "Meter": 17507,
    "End_Time_Stamp_UTC_ms": 1649354342015,
    "rejected_bad": 0,
    "Count": 15,
    "End_Date": "Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)",
    "rejected_duplicates": 0,
    "kWh_Tot_Max": 50812.4,
    "kWh_Tot_DeltaMax": 0.1,
    "kWh_Tot_Diff": 0.7,
    "Start_Date": "Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)",
    "Protocol": "v3"
}]
kWh_Tot_Max: 50812.4

[
    {
        "Start_Time_Stamp_UTC_ms": 1649353501837,
        "End_Time_Stamp_UTC_ms": 1649354342015,
        "End_Date": "Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)",
        "Start_Date": "Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)",
        "Meter": 17507,
        "Protocol": "v3",
        "Count": 15,
        "rejected_bad": 0,
        "rejected_duplicates": 0,
        "kWh_Tot_DeltaMin": 0,
        "kWh_Tot_DeltaMax": 0.1,
        "kWh_Tot_Min": 50811.7,
        "kWh_Tot_Max": 50812.4,
        "kWh_Tot_Diff": 0.7
    }
]
kWh_Tot_Max: 50812.4
[
  {
    Start_Time_Stamp_UTC_ms: 1649353501837,
    End_Time_Stamp_UTC_ms: 1649354342015,
    End_Date: 'Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)',  
    Start_Date: 'Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)',
    Meter: 17507,
    Protocol: 'v3',
    Count: 15,
    rejected_bad: 0,
    rejected_duplicates: 0,
    kWh_Tot_DeltaMin: 0,
    kWh_Tot_DeltaMax: 0.1,
    kWh_Tot_Min: 50811.7,
    kWh_Tot_Max: 50812.4,
    kWh_Tot_Diff: 0.7
  }
]
kWhTotMax: 50812.4

All summary requests will begin with the following information in the https address:

https://summary.ekmpush.com/summary?

The information that you provide, such as the meter number ID (i.e. 17507), your EKM Push Key (i.e. MTAxMDoyMDIw), and all other associated information will follow the beginning https address.

Example below of what a typical summary https address will look like:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=kWh_Tot*

Click to try

Example of the information that is in a typical https call is as follows:

https Address Description
https://summary.ekmpush.com/summary? Beginning of the https address
meters Parameter for calling the meter
17507 Exact meter to call
key Parameter for calling the key
MTAxMDoyMDIw EKM Push authorization key that is assigned to the meter
format Parameter for calling the file format to return as
html Language format to return the data as (html, xml, json, csv)
report Parameter for calling a specific time period
15 This will show 15 minute summary result increments. This is also the default time period number that the Summary API uses to return the results in if the report parameter is not specified
limit Parameter that sets the number of rows to show in the report
1 This will only show one row in the summary report. The default number is ten ( 10 ) that will show in the report if the limit parameter is not specified
field Parameter for calling specific fields in the report
kWh_Tot* Type of field to display in the summary results. An asterisk ( * ) will be included at the end of each field type if you are wanting to include all values in that field. Example: Calling the kWh_Tot* parameter will include the DeltaMin, DeltaMax, Min, Max and Diff values for the associated field.

Meter Number and Key

The EKM Summary Meter Number is the number of your meter that you have in service. In the following examples of this Summary API document, we will be using the meter number 17507 in all of our https calls. To use your own meter number simply replace the example meter number, 17507, with your own meter number.

The EKM Summary Key is the same Authorization Key that you received for your Realtime EKM Push Account. In the following examples of this Summary API document, we will be using the following key MTAxMDoyMDIw in all of our https calls. You will need to change the example key, of MTAxMDoyMDIw, with your own private key in order to access your meters that you have associated with your account.

Get a Specific Meter

This endpoint retrieves a specific meter and all the read data associated with it. In this example we will be using key MTExOjExMQ and meter number 300000369 to show a v4 meter. All other examples in this API will use the key MTAxMDoyMDIw and a v3 meter.

Get a Specific EKM Meter

curl -s "https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here

pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {

        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=300000369&key=MTExOjExMQ' +
    '&format=json&report=15&limit=5&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

If you would like to filter to just 1 meter you can add the filter: meters=METER_ID


In the example below the METER_ID being used is: 300000369

https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=html&report=15&limit=5&fields=kWh_Tot*

The link below is an example of the read data with the associated meter

https://summary.ekmpush.com/summary?meters=300000369&key=MTExOjExMQ&format=html&report=15&limit=5&fields=kWh_Tot*

Click to try


URL Parameters

Parameter Description
meters The ID or number of the meter you want to retrieve

Query Multiple Meters

Aggregate

Query Multiple Meters

curl -s "https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {

        // Call the callApi function to create a usable
        // object named apiObject from the API request URL.
        // Put the API request URL in the call
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*");

        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        System.out.println(apiObject.toString(4));

    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507~15635&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=5&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

⚠️ Deprecation Notice: Aggregation of Multiple Meters

Please note that the aggregation of multiple meters in the summary report is now deprecated and will not be available in the upcoming Summary V2 API. In the new version, the default behavior will be equivalent to setting the “bulk” parameter to 1, indicating that each meter will be reported separately as a bulk dump.

Therefore, starting from the next version of the API, the results of the summary report will no longer display the combined summary of all meters in a group. Instead, each meter will be reported individually. We recommend modifying your implementation accordingly to accommodate this change.

Support for meter group aggregation will end on January 1st 2024.

Thank you for your understanding and cooperation.

To see multiple meters in your summary report, for example: meters 17507 and 15635, your https address should look like the following:

https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*

Click to try


As you can see in the example above, all that is changed to the https address is the addition of the extra meter to the end of the meters parameter: 17507~15635.

The example below is the same as above except it is using a comma ( , ) to separate the meter numbers.

https://summary.ekmpush.com/summary?meters=17507,15635&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*

Click to try

This will allow you to call multiple meters to get their reports.

Bulk

Bulk

curl -s
"https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507~15635&key=MTAxMDoyMDIw'\
    '&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1")


# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        // Call the callApi function to create a usable
        // object named apiObject from the API request URL.
        // Put the API request URL in the call
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1");

        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507~15635&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The Bulk parameter is to override the default action to aggregate all meters in a group.

If Bulk is set, then all meters are reported separately as a bulk dump.


The Bulk parameter can be set to zero ( 0 ) or one ( 1 ) if including it in your https address. If the parameter is not included in the address then the summary results will default it to zero ( 0 ) and will aggregate the meters in the report and display it as a combined summary.

https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1

Click to try


URL Parameter

Parameter Description
bulk Can be either zero ( 0 ) or one ( 1 ). Default is zero ( 0 )

How to aggregate the meters in the report and display it as a combined summary

How to aggregate the meters in the report and display it as a combined summary

#!/bin/bash

# Fetch data from URL and use jq for processing
URL="https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1"
URL+="&normalize=1"

response=$(curl -s "$URL")

# Aggregate by Start_Time_Stamp_UTC_ms using jq
aggregated=$(echo "$response" | jq -r '
    map(select(.Start_Time_Stamp_UTC_ms)) |  # Filter entries with Start_Time_Stamp_UTC_ms
    group_by(.Start_Time_Stamp_UTC_ms) | 
    map({
        Start_Time_Stamp_UTC_ms: .[0].Start_Time_Stamp_UTC_ms,
        kWh_Tot_Max: (map(.kWh_Tot_Max | tonumber) | add),
        Count: (map(.Count | tonumber) | add),
        Meters: (map(.Meter) | unique | join(",")),
        End_Time_Stamp_UTC_ms: .[0].End_Time_Stamp_UTC_ms,
        Start_Date: .[0].Start_Date,
        End_Date: .[0].End_Date
    })')

# Prepare the CSV data using jq
csv_data=$(echo "$aggregated" | jq -r 'map([
    .Start_Time_Stamp_UTC_ms,
    .kWh_Tot_Max,
    .Count,
    .Meters,
    .End_Time_Stamp_UTC_ms,
    .Start_Date,
    .End_Date
] | @csv) | join("\n")')

# Write to CSV
CSV_FILENAME="output.csv"
echo "Start_Time_Stamp_UTC_ms,kWh_Tot_Max,Total_Count,Meters,End_Time_Stamp_UTC_ms,Start_Date,End_Date" > "$CSV_FILENAME"
echo -e "$csv_data" >> "$CSV_FILENAME"

echo "CSV saved to $CSV_FILENAME"

# Ruby Version: 3.1.2

require 'csv'
require 'json'
require 'net/http'

# Fetch data from URL
url = URI.parse('https://summary.ekmpush.com/summary?meters=17507~15635&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1')
url.query += '&normalize=1' # Add the normalize parameter

response = Net::HTTP.get_response(url)
data = JSON.parse(response.body)

# Aggregate by Start_Time_Stamp_UTC_ms
aggregated = {}

data.each do |entry|
  timestamp = entry['Start_Time_Stamp_UTC_ms']
  unless aggregated.key?(timestamp)
    aggregated[timestamp] = {
      'kWh_Tot_Max' => 0,
      'Count' => 0,
      'Meters' => [],
      'End_Time_Stamp_UTC_ms' => entry['End_Time_Stamp_UTC_ms'],
      'Start_Date' => entry['Start_Date'],
      'End_Date' => entry['End_Date']
    }
  end

  aggregated[timestamp]['kWh_Tot_Max'] += entry['kWh_Tot_Max']
  aggregated[timestamp]['Count'] += entry['Count']
  aggregated[timestamp]['Meters'] << entry['Meter'] unless aggregated[timestamp]['Meters'].include?(entry['Meter'])
end

# Prepare the CSV data
csv_data = []
aggregated.sort.to_h.each do |timestamp, values|
  meters = values['Meters'].join(',')
  csv_data << [
    timestamp,
    values['kWh_Tot_Max'],
    values['Count'],
    meters,
    values['End_Time_Stamp_UTC_ms'],
    values['Start_Date'],
    values['End_Date']
  ]
end

# Write to CSV
csv_filename = 'output.csv'
headers = %w[Start_Time_Stamp_UTC_ms kWh_Tot_Max Total_Count Meters
             End_Time_Stamp_UTC_ms Start_Date End_Date]
CSV.open(csv_filename, 'w', write_headers: true, headers: headers) do |csv|
  csv_data.each { |row| csv << row }
end

puts "CSV saved to #{csv_filename}"

'''
Python version: 3.10.6
'''

import csv
import requests

# Fetch data from URL
URL = "https://summary.ekmpush.com/summary?meters=17507~15635&"\
    "key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1"

URL += "&normalize=1"

response = requests.get(URL)
data = response.json()

# Aggregate by Start_Time_Stamp_UTC_ms
aggregated = {}

for entry in data:
    timestamp = entry["Start_Time_Stamp_UTC_ms"]
    if timestamp not in aggregated:
        aggregated[timestamp] = {
            "kWh_Tot_Max": 0,
            "Count": 0,
            "Meters": [],
            "End_Time_Stamp_UTC_ms": entry["End_Time_Stamp_UTC_ms"],
            "Start_Date": entry["Start_Date"],
            "End_Date": entry["End_Date"]
        }

    aggregated[timestamp]["kWh_Tot_Max"] += entry["kWh_Tot_Max"]
    aggregated[timestamp]["Count"] += entry["Count"]
    if entry["Meter"] not in aggregated[timestamp]["Meters"]:
        aggregated[timestamp]["Meters"].append(entry["Meter"])

# Prepare the CSV data
csv_data = []
for timestamp, values in sorted(aggregated.items()):
    METERS = ",".join(str(m) for m in values["Meters"])
    csv_data.append([
        timestamp,
        values["kWh_Tot_Max"],
        values["Count"],
        METERS,
        values["End_Time_Stamp_UTC_ms"],
        values["Start_Date"],
        values["End_Date"]
    ])

# Write to CSV
CSV_FILENAME = "output.csv"
with open(CSV_FILENAME, 'w', newline='', encoding="utf-8") as csvfile:
    csvwriter = csv.writer(csvfile)
    csvwriter.writerow(["Start_Time_Stamp_UTC_ms", "kWh_Tot_Max", "Total_Count",
                        "Meters", "End_Time_Stamp_UTC_ms", "Start_Date", "End_Date"])
    csvwriter.writerows(csv_data)

print(f"CSV saved to {CSV_FILENAME}")

<?php
// PHP 8.1.2 (cli)

// Fetch data from URL
$url = "https://summary.ekmpush.com/summary?meters=17507~15635&" .
    "key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1";

$url .= "&normalize=1"; // Add the normalize parameter

$response = file_get_contents($url);
$data = json_decode($response, true);

// Aggregate by Start_Time_Stamp_UTC_ms
$aggregated = array();

foreach ($data as $entry) {
    $timestamp = $entry["Start_Time_Stamp_UTC_ms"];
    if (!array_key_exists($timestamp, $aggregated)) {
        $aggregated[$timestamp] = array(
            "kWh_Tot_Max" => 0,
            "Count" => 0,
            "Meters" => array(),
            "End_Time_Stamp_UTC_ms" => $entry["End_Time_Stamp_UTC_ms"],
            "Start_Date" => $entry["Start_Date"],
            "End_Date" => $entry["End_Date"]
        );
    }

    $aggregated[$timestamp]["kWh_Tot_Max"] += $entry["kWh_Tot_Max"];
    $aggregated[$timestamp]["Count"] += $entry["Count"];
    if (!in_array($entry["Meter"], $aggregated[$timestamp]["Meters"])) {
        $aggregated[$timestamp]["Meters"][] = $entry["Meter"];
    }
}

// Prepare the CSV data
$csv_data = array();
ksort($aggregated);
foreach ($aggregated as $timestamp => $values) {
    $meters = implode(',', $values["Meters"]);
    $csv_data[] = array(
        $timestamp,
        $values["kWh_Tot_Max"],
        $values["Count"],
        $meters,
        $values["End_Time_Stamp_UTC_ms"],
        $values["Start_Date"],
        $values["End_Date"]
    );
}

// Write to CSV
$csv_filename = "output.csv";
$csv_file = fopen($csv_filename, 'w');
fputcsv($csv_file, array("Start_Time_Stamp_UTC_ms", "kWh_Tot_Max", "Total_Count", "Meters", "End_Time_Stamp_UTC_ms", "Start_Date", "End_Date"));
foreach ($csv_data as $row) {
    fputcsv($csv_file, $row);
}
fclose($csv_file);

echo "CSV saved to $csv_filename";
?>

#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.28
# Perl Modules Version:
# JSON: 4.10
# Text::CSV: 2.03
# LWP::Simple: 6.72
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan Text::CSV
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Text::CSV;

# Always use lexical filehandles and 3-arg open
my $csv_filename = "output.csv";
open my $fh, '>:encoding(utf8)', $csv_filename or die "Failed to open CSV file: $!";

# Fetch data from URL
my $url = "https://summary.ekmpush.com/summary?meters=17507~15635&" .
    "key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1";

$url .= "&normalize=1"; # Add the normalize parameter

my $response = get($url);
die "Failed to retrieve data from URL: $!" unless defined $response;
my $data = decode_json($response);

# Use a more readable structure for initializing hashes
my %aggregated;

for my $entry (@$data) {
    my $timestamp = $entry->{"Start_Time_Stamp_UTC_ms"};
    unless (exists $aggregated{$timestamp}) {
        $aggregated{$timestamp} = {
            kWh_Tot_Max => 0,
            Count       => 0,
            Meters      => [],
            End_Time_Stamp_UTC_ms => $entry->{"End_Time_Stamp_UTC_ms"},
            Start_Date  => $entry->{"Start_Date"},
            End_Date    => $entry->{"End_Date"},
        };
    }

    $aggregated{$timestamp}{kWh_Tot_Max} += $entry->{"kWh_Tot_Max"};
    $aggregated{$timestamp}{Count}       += $entry->{"Count"};

    my @meters = @{$aggregated{$timestamp}{Meters}};
    my $meter = $entry->{"Meter"};
    push @meters, $meter unless grep { $_ eq $meter } @meters;
    $aggregated{$timestamp}{Meters} = \@meters;
}

# Prepare the CSV data
my @csv_data;
for my $timestamp (sort keys %aggregated) {
    my $meters = join(',', @{$aggregated{$timestamp}{Meters}});
    push @csv_data, [
        $timestamp,
        $aggregated{$timestamp}{kWh_Tot_Max},
        $aggregated{$timestamp}{Count},
        $meters,
        $aggregated{$timestamp}{End_Time_Stamp_UTC_ms},
        $aggregated{$timestamp}{Start_Date},
        $aggregated{$timestamp}{End_Date},
    ];
}

# Write to CSV
my $csv = Text::CSV->new({ binary => 1, eol => $/ });
$csv->print($fh, ["Start_Time_Stamp_UTC_ms", "kWh_Tot_Max", "Total_Count", "Meters", "End_Time_Stamp_UTC_ms", "Start_Date", "End_Date"]);
for my $row (@csv_data) {
    $csv->print($fh, $row);
}
close $fh;

print "CSV saved to $csv_filename\n";

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;

import org.json.JSONArray;
import org.json.JSONObject;

@SuppressWarnings("unchecked")

public class EKM {
    public static void main(String[] args) {
        try {
            // Fetch data from URL
            String urlString = "https://summary.ekmpush.com/summary?meters=17507~15635&" +
                "key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1";

            urlString += "&normalize=1"; // Add the normalize parameter

            URL url = new URL(urlString);
            HttpURLConnection connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("GET");

            try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
                StringBuilder response = new StringBuilder();
                String line;
                while ((line = reader.readLine()) != null) {
                    response.append(line);
                }

                JSONArray data = new JSONArray(response.toString());

                // Aggregate by Start_Time_Stamp_UTC_ms
                Map<Long, Map<String, Object>> aggregated = new HashMap<>();

                for (int i = 0; i < data.length(); i++) {
                    JSONObject entry = data.getJSONObject(i);
                    long timestamp = entry.getLong("Start_Time_Stamp_UTC_ms");
                    aggregated.computeIfAbsent(timestamp, k -> new HashMap<>());

                    Map<String, Object> values = aggregated.get(timestamp);
                    values.putIfAbsent("kWh_Tot_Max", 0.0);
                    values.putIfAbsent("Count", 0);
                    values.putIfAbsent("Meters", new ArrayList<String>());
                    values.putIfAbsent("End_Time_Stamp_UTC_ms", entry.getLong("End_Time_Stamp_UTC_ms"));
                    values.putIfAbsent("Start_Date", entry.getString("Start_Date"));
                    values.putIfAbsent("End_Date", entry.getString("End_Date"));

                    double kWh_Tot_Max = entry.optDouble("kWh_Tot_Max", 0.0);
                    int count = entry.optInt("Count", 0);
                    String meter = entry.optString("Meter", "N/A");

                    values.put("kWh_Tot_Max", (Double) values.get("kWh_Tot_Max") + kWh_Tot_Max);
                    values.put("Count", (Integer) values.get("Count") + count);

                    List<String> meters = (List<String>) values.get("Meters");
                    if (!meters.contains(meter)) {
                        meters.add(meter);
                    }
                }

                // Prepare the CSV data
                List<String> csvData = new ArrayList<>();
                csvData.add("Start_Time_Stamp_UTC_ms,kWh_Tot_Max,Total_Count,Meters,End_Time_Stamp_UTC_ms,Start_Date,End_Date");
                for (Map.Entry<Long, Map<String, Object>> entry : aggregated.entrySet()) {
                    long timestamp = entry.getKey();
                    Map<String, Object> values = entry.getValue();
                    String meters = String.join(",", (List<String>) values.get("Meters"));
                    String csvRow = String.format("%d,%.2f,%d,\"%s\",%d,%s,%s",
                            timestamp,
                            (Double) values.get("kWh_Tot_Max"),
                            (Integer) values.get("Count"),
                            meters,
                            (Long) values.get("End_Time_Stamp_UTC_ms"),
                            values.get("Start_Date"),
                            values.get("End_Date"));
                    csvData.add(csvRow);
                }

                // Write to CSV
                String csvFileName = "output.csv";
                try (BufferedWriter writer = new BufferedWriter(new FileWriter(csvFileName))) {
                    for (String csvRow : csvData) {
                        writer.write(csvRow + "\n");
                    }
                }

                System.out.println("CSV saved to " + csvFileName);
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                connection.disconnect(); // Close the connection
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

<!DOCTYPE html>
<html>
<head>
</head>
<body>
    <div id="result"></div>

    <script type="text/javascript">
        // Fetch data from URL
        const URL = 'https://summary.ekmpush.com/summary?meters=17507~15635&' +
            'key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1';

        const normalizedURL = `${URL}&normalize=1`;

        const xhr = new XMLHttpRequest();
        xhr.open('GET', normalizedURL, true);

        xhr.onload = function () {
            if (xhr.status >= 200 && xhr.status < 300) {
                const jsonData = JSON.parse(xhr.responseText);

                // Aggregate by Start_Time_Stamp_UTC_ms
                const aggregated = {};

                jsonData.forEach((entry) => {
                    const timestamp = entry.Start_Time_Stamp_UTC_ms;

                    if (!aggregated[timestamp]) {
                        aggregated[timestamp] = {
                            kWh_Tot_Max: 0,
                            Count: 0,
                            Meters: [],
                            End_Time_Stamp_UTC_ms: entry.End_Time_Stamp_UTC_ms,
                            Start_Date: entry.Start_Date,
                            End_Date: entry.End_Date
                        };
                    }

                    aggregated[timestamp].kWh_Tot_Max += entry.kWh_Tot_Max;
                    aggregated[timestamp].Count += entry.Count;

                    if (!aggregated[timestamp].Meters.includes(entry.Meter)) {
                        aggregated[timestamp].Meters.push(entry.Meter);
                    }
                });

                // Prepare the CSV data
                const csvData = [];
                Object.entries(aggregated).forEach(([timestamp, values]) => {
                    const METERS = `"${values.Meters.join(', ')}"`;
                    csvData.push([
                        timestamp,
                        values.kWh_Tot_Max,
                        values.Count,
                        METERS,
                        values.End_Time_Stamp_UTC_ms,
                        values.Start_Date,
                        values.End_Date
                    ]);
                });

                // Display the CSV content
                const csvContent = 'Start_Time_Stamp_UTC_ms,kWh_Tot_Max,Total_Count,Meters,End_Time_Stamp_UTC_ms,Start_Date,End_Date\n' +
                    csvData.map(row => row.join(',')).join('\n');

                document.getElementById('result').innerHTML = `<pre>${csvContent}</pre>`;
                console.log(`CSV content displayed in the result div.`);
            } else {
                console.error(`Error fetching data: ${xhr.status} - ${xhr.statusText}`);
            }
        };

        xhr.onerror = function () {
            console.error(`Network error while fetching data.`);
        };

        xhr.send();
    </script>
</body>
</html>


/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const fs = require('fs')
const axios = require('axios')

// Fetch data from URL
const URL = 'https://summary.ekmpush.com/summary?meters=17507~15635&' +
    'key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*&bulk=1'

const normalizedURL = `${URL}&normalize=1`

axios.get(normalizedURL)
  .then((response) => {
    const jsonData = response.data

    // Aggregate by Start_Time_Stamp_UTC_ms
    const aggregated = {}

    jsonData.forEach((entry) => {
      const timestamp = entry.Start_Time_Stamp_UTC_ms

      if (!aggregated[timestamp]) {
        aggregated[timestamp] = {
          kWh_Tot_Max: 0,
          Count: 0,
          Meters: [],
          End_Time_Stamp_UTC_ms: entry.End_Time_Stamp_UTC_ms,
          Start_Date: entry.Start_Date,
          End_Date: entry.End_Date
        }
      }

      aggregated[timestamp].kWh_Tot_Max += entry.kWh_Tot_Max
      aggregated[timestamp].Count += entry.Count

      if (!aggregated[timestamp].Meters.includes(entry.Meter)) {
        aggregated[timestamp].Meters.push(entry.Meter)
      }
    })

    // Prepare the CSV data
    const csvData = []
    Object.entries(aggregated).forEach(([timestamp, values]) => {
      const METERS = values.Meters.join(',')
      csvData.push([
        timestamp,
        values.kWh_Tot_Max,
        values.Count,
        METERS,
        values.End_Time_Stamp_UTC_ms,
        values.Start_Date,
        values.End_Date
      ])
    })

    // Write to CSV
    const CSV_FILENAME = 'output.csv'
    const csvContent = 'Start_Time_Stamp_UTC_ms,kWh_Tot_Max,Total_Count,Meters,End_Time_Stamp_UTC_ms,Start_Date,End_Date\n' +
      csvData.map(row => row.join(',')).join('\n')

    fs.writeFileSync(CSV_FILENAME, csvContent)

    console.log(`CSV saved to ${CSV_FILENAME}`)
  })
  .catch((error) => {
    console.error(`Error fetching data: ${error.message}`)
  })

Check code examples for aggregating the meters in the report and displaying them as a combined summary.

Output Formats

Output Formats

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=xml&report=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns XML structured like this:

<summaries>
<summary>
<Start_Time_Stamp_UTC_ms>1649353501837</Start_Time_Stamp_UTC_ms>
<End_Time_Stamp_UTC_ms>1649354342015</End_Time_Stamp_UTC_ms>
<End_Date>Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)</End_Date>
<Start_Date>Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)</Start_Date>
<Meter>17507</Meter>
<Protocol>v3</Protocol>
<Count>15</Count>
<rejected_bad>0</rejected_bad>
<rejected_duplicates>0</rejected_duplicates>
<kWh_Tot_DeltaMin>0</kWh_Tot_DeltaMin>
<kWh_Tot_DeltaMax>0.1</kWh_Tot_DeltaMax>
<kWh_Tot_Min>50811.7</kWh_Tot_Min>
<kWh_Tot_Max>50812.4</kWh_Tot_Max>
<kWh_Tot_Diff>0.7</kWh_Tot_Diff>
</summary>
</summaries>

Output forat: JSON


https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns JSON structured like this:


[
   {
      "Start_Time_Stamp_UTC_ms": 1649353501837,
      "End_Time_Stamp_UTC_ms": 1649354342015,
      "End_Date": "Thu Apr 07 2022 17:59:02 GMT+0000 (GMT)",
      "Start_Date": "Thu Apr 07 2022 17:45:01 GMT+0000 (GMT)",
      "Meter": 17507,
      "Protocol": "v3",
      "Count": 15,
      "rejected_bad": 0,
      "rejected_duplicates": 0,
      "kWh_Tot_DeltaMin": 0,
      "kWh_Tot_DeltaMax": 0.1,
      "kWh_Tot_Min": 50811.7,
      "kWh_Tot_Max": 50812.4,
      "kWh_Tot_Diff": 0.7
   }
]

Output format: CSV


https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns CSV structured like this:


Start_Time_Stamp_UTC_ms,End_Time_Stamp_UTC_ms,End_Date,Start_Date,Meter,Protocol,Count,rejected_bad,rejected_duplicates,kWh_Tot_DeltaMin,kWh_Tot_DeltaMax,kWh_Tot_Min,kWh_Tot_Max,kWh_Tot_Diff
1649353501837,1649354342015,Thu Apr 07 2022 17:59:02 GMT+0000 (GMT),Thu Apr 07 2022 17:45:01 GMT+0000 (GMT),17507,v3,15,0,0,0,0.1,50811.7,50812.4,0.7

You can call up different output formats to return the summary results in. These formats can be: HTML, XML, JSON and CSV.

To retrieve the different formats, all that is required is to change the FORMAT, to the type you want to call.

Example URL

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=FORMAT&report=15&limit=1&timelimit=1&fields=kWh_Tot*


The example below will return the meter data in the HTML format. ( HyperText Markup Language )

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


Click the link below to see the meter data returned in the XML format. ( Extensible Markup Language )

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=xml&report=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


Click the link below to see the meter data returned in the JSON format. ( JavaScript Object Notation )

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


Click the link below to see the meter data returned in the CSV format. ( Comma Separated Values )

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


URL Parameters

Parameter Description
format Available formats are: html, xml, json, and csv

Reports

Report

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)


<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/


//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The report parameter is used to define the time period in which the summary results are returned as.

The example below shows the https address format. Parameters than can be used are as follows: 15 is for a 15 minute summary report, hr is for an hourly summary report, dy is for a daily summary report, wk is for a weekly summary report, and mo is for a monthly summary report. Range is used to aggregate all summaries within the set date range into one summary report.

Replace REPORT with one of the report parameters that you want to call the meter reading in.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=REPORT&fields=kWh_Tot*


Example for the 15 minute summary report:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*

Click to try


Example for the hr

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=hr&fields=kWh_Tot*

Click to try


Example for the dy

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=dy&fields=kWh_Tot*

Click to try


Example for the wk

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=wk&fields=kWh_Tot*

Click to try


Example for the mo

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=mo&fields=kWh_Tot*

Click to try


The example below is used when calling for a monthly summary report that is used in a billing cycle. Replace the # in the mo# call with a number correlating to a day of the month, between 2-28.

Example: report=mo15.

Example URL:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=mo#&fields=kWh_Tot*

Example for the monthly range

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=mo15&fields=kWh_Tot*

Click to try


Example for range

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=range&fields=kWh_Tot*

Click to try


URL Parameters

Parameter Description
report 15, hr, dy, wk, mo, mo#, range

Number of Summaries

Number of Summaries

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json'\
  '&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles\
&fields=kWh_Tot*~RMS_Volts_Ln_1*")

# This just displays the object but you can use what ever
# code you would like to work with the object here

pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=20&timezone=America~Los_Angeles' +
    '&fields=kWh_Tot*~RMS_Volts_Ln_1*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The limit parameter determines the number of rows to show in the summary results. If the limit call is not included in the url it will default to the number of rows to show in the results page. The default number will be 10 ( ten ) rows. If your summary report results exceed more than the default amount of rows needed, then you must set the number of rows in the limit parameter. If you use the default amount of rows then your summary will not display all of the results that were queried.

The Limit number can be any number from 1 to the number of summary rows that you need to display.

The following is an example of what your https address will look like when calling the limit parameter:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=LIMIT&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Replace LIMIT with the number 20 to call the number of rows to display in the summary results:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*


The link below will show the example of the meter data that is associated with the provided key and the specified number of 20 summary rows on the results page. It will display it as html data.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


You can also request anywhere from 1 to 1000 rows to display in the summary results depending on your needs.

For 1 row replace LIMIT with the number 1 as in the example below:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=1&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


or for 1000 rows replace LIMIT with the number 1000 as in the example below:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=1000&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


URL Parameters

Parameters Description
limit Number of rows to display in the summary results page

Offset & Timelimit

Offset

Offset

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw'\
  '&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0\
&fields=kWh_Tot*~RMS_Volts_Ln_1*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The offset parameter is used when you want to paginate through the summary results.

The offset can be zero ( 0 ) or any number greater than. The default is zero ( 0 ) if not specified in the https address.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=OFFSET&fields=kWh_Tot*~RMS_Volts_Ln_1*

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try

URL Parameter

Parameter Description
offset Any number from zero ( 0 ) to the number needed

Timelimit

Timelimit

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&'\
  'timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&\
timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.2.14 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject = callApi('https://summary.ekmpush.com/summary?' .
        'meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&' .
        'timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi($apiRequest = '')
{

        $json = @file_get_contents($apiRequest);
        $jsonObject = json_decode($json);
        return ($jsonObject);
}

#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
    'https://summary.ekmpush.com/summary?' .
    'meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&' .
    'timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?"+
            "meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&"+
            "timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
  <head>
    <script type="text/javascript">
      // The example function is called from the
      // body tag when the page loads
      function example() {
        // Call the callApi function to create a usable
        // object named apiObject from the API request URL.
        // Put the API request URL in the call
        callApi(
          "https://summary.ekmpush.com/summary?" +
            "meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&" +
            "timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*",
          function (apiObject) {
            // This just displays the object in the result div
            // you can use what ever code you would like to work
            // with the object here
            document.getElementById("result").innerHTML =
              "<pre>" + JSON.stringify(apiObject, null, 4) + "</pre>";
          }
        );
      }

      // This code accesses the apiRequest URL and converts
      // the contents to a usable JSON object named apiObject
      function callApi(apiRequest, callback) {
        var xhttp = new XMLHttpRequest();
        xhttp.onreadystatechange = function () {
          if (xhttp.readyState == 4 && xhttp.status == 200) {
            var jsonObject = JSON.parse(xhttp.responseText);
            callback(jsonObject);
          }
        };
        xhttp.open("GET", apiRequest, true);
        xhttp.send();
      }
    </script>
  </head>
  <body onload="example()">
    <div id="result" />
  </body>
</html>

/*
* Requirements
* NodeJS: v20.10.0
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw&' +
    'format=json&report=hr&limit=10&' +
    'timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The timelimit parameter is used only to calculate the default start_date. The number that is input in the timelimit parameter is subtracted from the end_date.

Example: If you set the timelimit to equal 5, then the default start_date will begin 5 hours before the end_date. If your end_date is 12:00 P.M. then your start_date will begin at 7:00 A.M. Your summary results will begin from that time.


The timelimit parameter can be one ( 1 ) or any positive integer.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=TIMELIMIT&fields=kWh_Tot*~RMS_Volts_Ln_1*


In the upcoming scenario, we will utilize ‘timelimit = 5,’ specifying the retrieval of data from five hours before the current time:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


If you want to establish a particular 'end_date,’ like 202402011200, and fetch data from five hours before that time, you should submit the request as follows:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=5&end_date=202402011200&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


URL Parameter

Parameter Description
timelimit Any number from one ( 1 ) to the number needed

Time Zones

Time Zones

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://io.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json'\
  '&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5\
&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=10&offset=0&timelimit=5' +
    '&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The Summary Time Zone parameter by default will return the time as UTC Time (computer time) in milliseconds. It will also show the time in the standard time format.

If you would like the time returned in a specific time zone you can add this to the URL call:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=TIME_ZONE&fields=kWh_Tot*~RMS_Volts_Ln_1*

In the example below the TIME_ZONE that is being requested is the country of America and the city where the meter is in service, is Los Angeles.

The time zone of this location will be in the PACIFIC TIME ZONE, UTC offset -8:00.


The example link below will return the html request for the given parameters in the https address.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


Click the link below to go to the Wikipedia database for time zones and related information.

Click for Time Zone Information


URL Parameters

Parameter Description
timezone The time zone is the country and city where the meter is in service. Example: America~Los_Angeles.

Start Date & End Date

Start Date & End Date

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json'\
  '&report=hr&limit=25&offset=0&timezone=America~Los_Angeles'\
  '&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0\
&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles' +
    '&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

You can also call the available summary reports for a given meter by a specified date with the following parameters in the URL address:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=YYYYMMDDhhmm&end_date=YYYYMMDDhhmm&fields=kWh_Tot*

Date Parameters

Parameters Description
YYYY Indicates the year to be called. example: 2021
MM Indicates the month to be called. Example: 12, for the month of December
DD Indicates the day of the month. Example: 01, for the first day of the month
hh Indicates the hour of the day. Example: 0900, for 9 A.M.
mm Indicates the minutes of the hour. Example: 0930, for 30 minutes into the hour of 9 A.M. or 9:30 A.M.

Lets say you would like to pull the summary report for December 01, 2021 9:00 A.M. to December 02, 2021 8:00 A.M.. Your https address should look like the following:

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*

Click the link below to see an example.

Click to try


Range is used to aggregate all summaries within the set date range into one summary report.

Example of range for the report parameter

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=range&timezone=America~Los_Angeles&start_date=202112010900&end_date=202112020800&fields=kWh_Tot*

Click to try

URL Parameters

Parameter Description
start_date Date for the summary report to begin. Example of YYYYMMDDhhmm is as follows: 201912010900 = December 01, 2019 9:00 A.M.
end_date Data for the summary report to end. Example of YYYYMMDDhhmm is as follows: 201912020800 = December 02, 2019 8:00 A.M.

Hours

Hours

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*")

# This just displays the object but you can use what ever
# code you would like to work with the object here

pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&hours=1300-1530&fields=kWh_Tot*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

You can also call the available summary results for a given meter by a specified time in the current day with the following https hours parameter.

This parameter is used to show the summary reports between the provided start and end hours. Example: 1300-1530

hours: hhmm-hhmm ( default 0000-2359 from 0000 to 2359 hours )

All time parameters will be in the 24-hour clock format, or military time.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&hours=hhmm-hhmm&fields=kWh_Tot*

Time Parameters

Parameter Description
hh Indicates the hour of the day. Example: 1300 for 1:00 P.M.
mm Indicates the minutes of the hour. Example: 1530 for 3:30 P.M.

Click the link below to see an example.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=kWh_Tot*

Click to try


URL Parameters

Parameter Description
hours The Format in which the Time is written in: hhmm - hours, minutes. Example: 1530 for 3:30 P.M.

Days

Days

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*&days=mon',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&fields=kWh_Tot*&days=mon');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The Days parameter is the same as the Hours parameter. It is used to check field values on specified days, rather than specified hours.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*&days=DAYS

Just replace DAYS with a day of the week.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*&days=mon

Click to try

If you want to set more than 1 ( one ) day all that is needed is to use a tilde ( ~ ) in between each of the days that you want to include in the URL.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*&days=mon~tue~wed

Click to try


Click the link below to see an example.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=wk&limit=10&fields=kWh_Tot*&days=mon

Click to try


Days Parameters

Parameters Description
mon Monday
tue Tuesday
wed Wednesday
thu Thursday
fri Friday
sat Saturday
sun Sunday

Fields

Fields

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*"

# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json'\
  '&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0\
&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>

/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=10&offset=0&timelimit=5' +
    '&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

You can filter for just the summary fields you are interested in by using fields=FIELDS parameter in the https address.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=FIELDS


In the example below we are only interested in finding out the kWh_Tot and RMS_Volts_ln_1. To retrieve the data associated with the different fields use the abbreviated name of the fields you are interested in after the fields parameter, followed by a tilde separator ( ~ ), or a comma ( , ), if calling for more than one field.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


The example below is the same as the one above, except this shows the address with a comma after the fields name instead of the tilde separator.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*,RMS_Volts_Ln_1*

Appending the asterisk ( * ) at the end of the field name will show all matching field values associated with the provided fields name.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try

As you can see from the example above that when you append the asterisk ( * ) at the end of the fields name it returns all the associated values with that given fields.

For example, when you call the fields kWh_Tot* the results will include the values of DeltaMin, DeltaMax, Min, Max and Diff.


If you do not want to have all the fields results show in your query, or if you are only interested in a specific fields value you can call it by including the value at the end of the fields name instead of using the asterisk ( * ).

Example: kWh_Tot_DeltaMax

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_DeltaMax,kWh_Tot_Max

Click to try


Example: kWh_Tot_Max

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_Max

Click to try


If you want to include more than one fields value but not all associated values for a given fields, you would add that value to the address like you were calling another fields name.

Example: kWh_Tot_DeltaMax~kWh_Tot_Max

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_DeltaMax~kWh_Tot_Max

Click to try


The data fields that you are interested in are not limited to these two in the examples above. You can add just one field or include as many fields as your needs require.

URL Parameters

The fields below are the Summary fields for v3, v4 and v5 meters

FieldDescription
kWh_Tot*Total Kilowatt Hour
Show sub-fields
kWh_Tariff_1* Kilowatt Hour for Tariff 1
Show sub-fields
kWh_Tariff_2* Kilowatt Hour for Tariff 2
Show sub-fields
kWh_Tariff_3* Kilowatt Hour for Tariff 3
Show sub-fields
kWh_Tariff_4* Kilowatt Hour for Tariff 4
Show sub-fields
Rev_kWh_Tot* Total Reverse Kilowatt Hour
Show sub-fields
Rev_kWh_Tariff_1* Reverse Kilowatt Hour for Tariff 1
Show sub-fields
Rev_kWh_Tariff_2* Reverse Kilowatt Hour for Tariff 2
Show sub-fields
Rev_kWh_Tariff_3* Reverse Kilowatt Hour for Tariff 3
Show sub-fields
Rev_kWh_Tariff_4* Reverse Kilowatt Hour for Tariff 4
Show sub-fields

RMS_Volts_Ln_1* Root-Mean-Squared Volts on Ln 1
Show sub-fields

RMS_Volts_Ln_2* Root-Mean-Squared Volts on line 2
Show sub-fields

RMS_Volts_Ln_3* Root-Mean-Squared Volts on line 3
Show sub-fields

Amps_Ln_1* Amps on line 1
Show sub-fields

Amps_Ln_2* Amps on line 2
Show sub-fields

Amps_Ln_3* Amps on line 3
Show sub-fields

RMS Watts_Ln_1* Root-Mean-Squared Watts on line 1
Show sub-fields

RMS Watts_Ln_2* Root-Mean-Squared Watts on line 2
Show sub-fields

RMS Watts_Ln_3* Root-Mean-Squared Watts on line 3
Show sub-fields

RMS Watts_Tot* Total Root-Mean-Squared Watts all lines
Show sub-fields

Power_Factor_Ln_1* Power Factor on line 1
Show sub-fields

Power_Factor_Ln_2* Power Factor on line 2
Show sub-fields

Power_Factor_Ln_3* Power Factor on line 3
Show sub-fields

RMS_Watts_Max_Demand* Root-Mean-Squared Watts Max Demand
Show sub-fields
CT_Ratio* Current Transformer Ratio
Show sub-fields

The fields below are additional Summary fields only for v4 and v5 meters

Pulse_Cnt_1* Pulse Count on Input 1
Show sub-fields

Pulse_Cnt_2* Pulse Count on Input 2
Show sub-fields

Pulse_Cnt_3* Pulse Count on Input 3
Show sub-fields

Pulse_Ratio_1* Pulse Input Ratio on Input 1
Show sub-fields
Pulse_Ratio_2* Pulse Input Ratio on Input 2
Show sub-fields
Pulse_Ratio_3* Pulse Input Ratio on Input 3
Show sub-fields
Reactive_Energy_Tot* Total Kilo Volt Amperes Reactive Hours (kVARh)
Show sub-fields

kWh_Rst* Resettable Kilowatt Hour
Show sub-fields
Rev_kWh_Rst* Resettable Reverse Kilowatt Hour
Show sub-fields
Reactive_Pwr_Ln_1* Volt-Amperes Reactive on line 1
Show sub-fields

Reactive_Pwr_Ln_2* Volt-Amperes Reactive on line 2
Show sub-fields

Reactive_Pwr_Ln_3* Volt-Amperes Reactive on line 3
Show sub-fields

Reactive_Pwr_Tot* Total Volt-Amperes Reactive
Show sub-fields

Line_Freq* Frequency (Hz)
Show sub-fields

kWh_Ln_1* Total Kilowatt Hour on Line 1
Show sub-fields
kWh_Ln_2* Total Kilowatt Hour on Line 2
Show sub-fields
kWh_Ln_3* Total kilowatt Hour on Line 3
Show sub-fields
Rev_kWh_Ln_1* Reverse Kilowatt Hour on Line 1
Show sub-fields
Rev_kWh_Ln_2* Reverse Kilowatt Hour on Line 2
Show sub-fields
Rev_kWh_Ln_3* Reverse Kilowatt Hour on Line 3
Show sub-fields
Max_Demand_Rst* Max Demand Auto Reset Status
OFF = 0
Monthly = 1
Weekly = 2
Daily = 3
Hourly = 4
Show sub-fields
Net_Calc_Watts_Ln_1* Net Watts on Line 1
Show sub-fields

Net_Calc_Watts_Ln_2* Net Watts on Line 2
Show sub-fields

Net_Calc_Watts_Ln_3* Net Watts on Line 3
Show sub-fields

Net_Calc_Watts_Tot* Total Net Watts
Show sub-fields
CF_Ratio* Settable Pulse Output Ratio (Crest Factor Ratio)
Show sub-fields

Normalize

Normalize

curl -s "https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1"
# Ruby Version: 3.1.2

# Load required modules
require 'net/http'
require 'json'
require 'uri'

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call

def call_api(api_path)
  uri = URI.parse("https://summary.ekmpush.com#{api_path}")
  response = Net::HTTP.get_response(uri)
  puts response.uri
  JSON.parse(response.body)
end

# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
# URI only NOT URL - Do not include https://summary.ekmpush.com
api_object = call_api('/summary?meters=17507&key=MTAxMDoyMDIw&format=json'\
  '&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object

'''
Python version: 3.9.12
'''

# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint

# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
    '''Make http request'''
    response = urllib.request.urlopen(api_request)
    response = response.read()
    json_object = json.loads(response.decode())
    return json_object

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call

api_object = call_api("https://summary.ekmpush.com/summary\
?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=12\
&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1")

# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)

<?php
// PHP 8.0.17 (cli)

// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1');

// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);

// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {

        $json=@file_get_contents($apiRequest);
        $jsonObject=json_decode($json);
        return ($jsonObject);

}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
#       cpan LWP::Simple
#       cpan LWP::Protocol::https
#       cpan JSON

# Required Perl Modules
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the api_request URL and converts
# the contents to a usable Perl object and returns it
sub call_api {
    my $api_request = shift;
    my $json_text   = get($api_request);
    my $json_object = JSON->new->utf8->decode($json_text);
    return $json_object;
}

# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
my $api_object = call_api(
'https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1'
);

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object);    ## no critic (InputOutput::RequireCheckedSyscalls)

/*
 openjdk version "17.0.2" 2022-01-18

 Download the correct org.json jar version for your
 needs from: https://mvnrepository.com/artifact/org.json/json

 This example uses version 20220320 accessible here:
 https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar

 Instructions to run this program

 1. Put this code in a file named EKM.java
 2. Copy the downloaded org.json jar and EKM.java to the same directory
 3. Compile
  javac -cp .:./json-20220320.jar ./EKM.java
 4. Run
  java -cp .:./json-20220320.jar EKM
*/

//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;

@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})

public class EKM {
    public static JSONArray callApi(String apiRequest) throws Exception {

        // This code accesses the apiRequest URL and converts
        // the contents to a usable JSON object

        URL url = new URL(apiRequest);
        URLConnection connection = url.openConnection();
        BufferedReader in = new BufferedReader(
                                               new InputStreamReader(
                                                                     connection.getInputStream()));

        StringBuilder response = new StringBuilder();
        String inputLine;

        while ((inputLine = in.readLine()) != null)
            response.append(inputLine);

        in.close();

        return new JSONArray(response.toString());
    }

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1");

        /*
         You can access any part of the apiObject using code like this:
         String Protocol = apiObject.getJSONObject(0).getString("Protocol");
        */

        // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

// The example function is called from the
// body tag when the page loads
function example(){

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1',function(apiObject){

       // This just displays the object in the result div
       // you can use what ever code you would like to work
       // with the object here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status == 200) {
        var jsonObject = JSON.parse(xhttp.responseText);
        callback(jsonObject);
      }
    };
    xhttp.open("GET", apiRequest, true);
    xhttp.send();
}
</script>

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios:  0.27.2
*/

const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://summary.ekmpush.com/summary',
  timeout: 1000 * 15,
  // The API may respond with different status codes
  // you want to see them in order to debug you query
  // This will return all codes between 200 ans 503
  validateStatus: (status) => status >= 200 && status < 504,
})

// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
  try {
    const res = await apiClient.get('?meters=17507&key=MTAxMDoyMDIw' +
    '&format=json&report=15&limit=12&timezone=America~Los_Angeles' +
    '&fields=kWh_Tot*&normalize=1');
    const apiResData = res.data;
    // This just displays the object but you can use what ever
    // code you would like to work with the object here
    console.log(apiResData);
  } catch (error) {
    console.error(error.message);
  }
})();

The normalize parameter rounds the Start Date times and End Date times to the beginning and end seconds of the parameter specified by the “Report” type. The beginning will be represented as :00 seconds. The end will be represented as :59 seconds. The hours and minutes would vary depending on the parameter specified by the “Report” type.

Example: If the report parameter is 15 ( 15 minutes ), then every row in the summary report will have the start date times be at 15 minute increments: 09:00:00, then 09:15:00, then 09:30:00 and so on. The end date times will end 15 minutes after the start date time: 09:14:59, then 09:29:59, then 09:44:59 and so on.

If you do not include the “Normalize” parameter in the https address it will use the default of zero ( 0 ). If the default is used the summary reports will not be rounded to the start date time of :00 seconds and end date time of :59 seconds. If you want the summary reports to have the start date time shown as :00 seconds and the end date time shown as :59 seconds, then the normalize parameter must be used and set to one ( 1 ).


The example below is what the https address will look like if using the normalize parameter with the report type set to 15 ( 15 minutes ).

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1

Click to try

The example below is without the normalize parameter.

https://summary.ekmpush.com/summary?meters=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*

Click to try

Summary V2 API

Click here to go to Summary V2 Documentation

Summary V2 API is a new set of summary features, such as First/Last to get the first and/or last reported date for the given meter(s)/ioStack(s), GStat for getting the status of one or more gateways, IOStack for getting information from new sensors, and more.

The API V2 summary and documentation are currently in beta, signifying that they are subject to changes and updates. It’s important to note that the API V2 calls and specifications provided in this documentation may undergo modifications as the beta phase progresses. Users should stay informed and regularly check for updates to ensure compatibility and adherence to the latest specifications

MQTT Messaging

Click here to go to MQTT Documentation

MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for low-bandwidth, high-latency, or unreliable networks, often used in Internet of Things (IoT) applications. It follows a publish-subscribe model, where devices (clients) can publish messages to topics or subscribe to topics to receive messages.

MQTT will only work with Push3 Gateways. It is more efficient than making hundreds of API calls because it does not impose rate limits (you can stream 24/7), allowing continuous realtime or summary data streaming. However, it lacks message history, meaning that if you need past data, you will have to make an API request to retrieve realtime or summary information as far back as necessary, and then resume streaming via MQTT. If the connection is lost, you will need to request realtime or summary data again to fill in any gaps before continuing with the MQTT stream. This combination of API and MQTT helps ensure a smooth data flow while compensating for potential disruptions.

RS-485 Communications

Click here to go to RS-485 Documentation

This section is for developers, or individuals, that want to communicate with their EKM Meters directly using their own software or embedded solution.

The code examples found in this section are in the simplest possible method to get you started. You are welcome to make them more robust.

First we start you out just connecting to the meter. You will find there is a very simple command line process to help you get started.

After that we cover the CRC method required for most communication to the meter.

Then we put it all together, in a simple test script that will show reads, and also open and close the relays.

Last we cover how to convert the 255 character strings that the meter responds with to a usable array containing field names and their values. It is our hope that after you go through these steps you will have all the information you need, to build whatever tools you like to access the meter.

Our meters use an IEC 62056-21 communication standard that has been optimized for our own needs. We are more than happy to share this with you. With this you can write your own software or embedded solution to access your meter data.

IEC 62056 is a set of standards for Electricity metering data exchange by International Electrotechnical Commission.

To learn more about the IEC 62056 standard click the button below to visit the WikiPedia website.

Additional PDF docs are available:

v.3 Meter Settings Protocol

v.3 Meter Parsing

v.4/v.5 Meter Settings Protocol

v.4/v.5 Meter Parsing

v.4/v.5 Meter Alternate Modbus Protocol

If you are coding in Python you can also make use of our ekmmeters.py API.

Status Codes

EKM uses conventional HTTP response codes in addition to our API Status Codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided, and codes in the 5xx range indicate an error with EKM’s servers (these are rare).

The EKM API uses the following API specific Status codes:

API Status Code Meaning
1000 There is not data for: {meters}
1001 There is not data for: {meters} between ${startDate} and ${endDate}
1002 There is not data for: {meters} This meter first reported on:
1003 There is not data for: {meters} This meter last reported on:
1004 Timezone is not supported for this date range request
1100 All invalid query requests
1101 Invalid format
1102 Invalid value
1103 Invalid parameter
1200 Found invalid meter: {meter} for key: MTAxMDoyMDIw
1300 Oops! It looks like there was an unexpected error. Try checking your query for issues or hold tight while we see what we can do. This error has been reported.

The EKM API also uses the following HTTP Status codes:

HTTP Status Code Meaning
200 OK – The request succeeded.
400 Bad Request – The server could not understand the request due to invalid syntax.
401 Unauthorized – Although the HTTP standard specifies “unauthorized”, semantically this response means “unauthenticated”. That is, the client must authenticate itself to get the requested response.
403 Forbidden – The client does not have access rights to the content; that is, it is unauthorized, so the server is refusing to give the requested resource. Unlike 401 Unauthorized, the client’s identity is known to the server.
404 Not Found – The server can not find the requested resource. In the browser, this means the URL is not recognized. In an API, this can also mean that the endpoint is valid but the resource itself does not exist. Servers may also send this response instead of 403 Forbidden to hide the existence of a resource from an unauthorized client. This response code is probably the most well known due to its frequent occurrence on the web.
429 Too Many Requests – The user has sent too many requests in a given amount of time (“rate limiting”).
500 Internal Server Error – The server has encountered a situation it does not know how to handle.
501 Not Implemented – The Vertical Bar otherwise known as “pipe” request method is not supported by the server and cannot be handled. The only methods that servers are required to support (and therefore that must not return this code) are GET and HEAD.
502 Bad Gateway – This error response means that the server, while working as a gateway to get a response needed to handle the request, got an invalid response.
503 Service Unavailable – The server is not ready to handle the request. Common causes are a server that is down for maintenance or that is overloaded. Note that together with this response, a user-friendly page explaining the problem should be sent. This response should be used for temporary conditions and the Retry-After HTTP header should, if possible, contain the estimated time before the recovery of the service. The webmaster must also take care about the caching-related headers that are sent along with this response, as these temporary condition responses should usually not be cached.
504 Gateway Timeout – This error response is given when the server is acting as a gateway and cannot get a response in time.
505 HTTP Version Not Supported – The HTTP version used in the request is not supported by the server.
506 Variant Also Negotiates – The server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
510 Not Extended – Further extensions to the request are required for the server to fulfill it.
511 Network Authentication Required – Indicates that the client needs to authenticate to gain network access.

Widget Documentation

Click here to go to Widget Documentation

Access free web-based real-time and historical graphs showcasing your EKM Push data, covering all your devices including meters and ioStacks. It’s quick, easy, and doesn’t require a login.

The EKM Widget offers a convenient means to gain visual insights into your systems’ performance. We utilize it to monitor our office’s current consumption and solar power generation in real-time. Additionally, the historical chart helps us track the impact of efficiency upgrades on our usage and monitor the energy consumption of our electric car over time.