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:
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]
Click here to go to Summary Documentation
Our Summary API takes every Real-Time read, over 15 minute time periods, and summarizes them into single 15 minute summaries. We store this data forever to provide a long term historical dataset for each meter. 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 a Summary API Request Builder Tool found here: Summary API Builder
Summary V2 API
Summary V2 is a collection of new summary features that will continue to expand over time.
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.
Check our API Builder: API Builder
HTTPS Request
Here is a guide on making HTTPS requests to fetch information from ioStack devices.
Meter - HTTPS Request
Summary API request example
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?' \
'devices=17507&key=MTAxMDoyMDIw&format=json&' \
'report=15&limit=1&fields=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
# This example digs deeper into the JSON and displays the first
# RMS_Volts_Ln_1_Average value for the first summary read
summary = api_object[0]
rms_volts_ln_1_average = summary['RMS_Volts_Ln_1_Average']
pp "RMS_Volts_Ln_1_Average: #{rms_volts_ln_1_average}"
'''
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"
"/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&"
"format=json&report=15&limit=1&fields=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)
# This example digs deeper into the JSON and displays the first
# RMS_Volts_Ln_1_Average value for the first summary read
summary = api_object[0]
rms_volts_ln_1_average = summary['RMS_Volts_Ln_1_Average']
print("RMS_Volts_Ln_1_Average: ", rms_volts_ln_1_average)
<?php
// PHP 8.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=1&' .
'fields=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 example digs deeper into the JSON and displays the first
// RMS_Volts_Ln_1_Average value for the first summary read
$summary = $apiObject[0];
$rms_volts_ln_1_average = $summary->RMS_Volts_Ln_1_Average;
echo "RMS_Volts_Ln_1_Average: $rms_volts_ln_1_average";
// 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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=1&' .
'fields=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)
# This example digs deeper into the JSON and displays the first
# RMS_Volts_Ln_1_Average value for the first summary read
my $summary = $api_object->[0];
my $rms_volts_ln_1_average = $summary->{RMS_Volts_Ln_1_Average};
print "RMS_Volts_Ln_1_Average: $rms_volts_ln_1_average"; ## no critic (InputOutput::RequireCheckedSyscalls)
/*
openjdk version "17.0.11" 2024-04-16
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
String apiUrl = "https://summary.ekmpush.com/summary/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&" +
"format=json&report=15&limit=1&" +
"fields=RMS_Volts_Ln_1";
JSONArray apiObject = EKM.callApi(apiUrl);
// 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
// RMS_Volts_Ln_1_Average value for the first summary read
JSONObject summary = apiObject.getJSONObject(0);
Object RMSVoltsLn1Average = summary.get("RMS_Volts_Ln_1_Average");
System.out.println("RMS_Volts_Ln_1_Average: " + RMSVoltsLn1Average);
}
}
<!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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=RMS_Volts_Ln_1",
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
// RMS_Volts_Ln_1_Average value for the first summary read
summary = apiObject[0];
rms_volts_ln_1_average = summary["RMS_Volts_Ln_1_Average"];
document.getElementById("rms_volts_ln_1_average").innerHTML =
"<pre>RMS_Volts_Ln_1_Average: " +
rms_volts_ln_1_average +
"</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="rms_volts_ln_1_average"></div>
</body>
</html>
/*
* Requirements
* NodeJS: v20.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json' +
'&report=15&limit=1&fields=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);
// This example digs deeper into the JSON and displays the
// RMS_Volts_Ln_1_Average value for the first summary read
const summary = apiResData[0];
const RMSVoltsLn1Average = summary.RMS_Volts_Ln_1_Average;
console.log(`RMS_Volts_Ln_1_Average: ${RMSVoltsLn1Average}`);
} catch (error) {
console.error(error.message);
}
})();
The above example returns the following results:
[
{
"End_Time_Stamp_UTC_ms":1721756699097,
"Start_Time_Stamp_UTC_ms":1721755813009,
"End_Date":"Tue Jul 23 2024 17:44:59 +0000 UTC",
"Start_Date":"Tue Jul 23 2024 17:30:13 +0000 UTC",
"Meter":17507,"Protocol":"v3",
"Count":270,
"RMS_Volts_Ln_1_First":123.5,
"RMS_Volts_Ln_1_Last":123.6,
"RMS_Volts_Ln_1_Min":123.4,
"RMS_Volts_Ln_1_Max":123.7,
"RMS_Volts_Ln_1_Average":123.58,
"RMS_Volts_Ln_1_MinTime":1721756041299,
"RMS_Volts_Ln_1_MaxTime":1721755833225,
"RMS_Volts_Ln_1_DeltaMin":-0.1,
"RMS_Volts_Ln_1_DeltaMax":0.2
}
]
[{"End_Time_Stamp_UTC_ms"=>1721756699097,
"Start_Time_Stamp_UTC_ms"=>1721755813009,
"End_Date"=>"Tue Jul 23 2024 17:44:59 +0000 UTC",
"Start_Date"=>"Tue Jul 23 2024 17:30:13 +0000 UTC",
"Meter"=>17507,
"Protocol"=>"v3",
"Count"=>270,
"RMS_Volts_Ln_1_First"=>123.5,
"RMS_Volts_Ln_1_Last"=>123.6,
"RMS_Volts_Ln_1_Min"=>123.4,
"RMS_Volts_Ln_1_Max"=>123.7,
"RMS_Volts_Ln_1_Average"=>123.58,
"RMS_Volts_Ln_1_MinTime"=>1721756041299,
"RMS_Volts_Ln_1_MaxTime"=>1721755833225,
"RMS_Volts_Ln_1_DeltaMin"=>-0.1,
"RMS_Volts_Ln_1_DeltaMax"=>0.2}]
"RMS_Volts_Ln_1_Average: 123.58"
[{'Count': 270,
'End_Date': 'Tue Jul 23 2024 17:44:59 +0000 UTC',
'End_Time_Stamp_UTC_ms': 1721756699097,
'Meter': 17507,
'Protocol': 'v3',
'RMS_Volts_Ln_1_Average': 123.58,
'RMS_Volts_Ln_1_DeltaMax': 0.2,
'RMS_Volts_Ln_1_DeltaMin': -0.1,
'RMS_Volts_Ln_1_First': 123.5,
'RMS_Volts_Ln_1_Last': 123.6,
'RMS_Volts_Ln_1_Max': 123.7,
'RMS_Volts_Ln_1_MaxTime': 1721755833225,
'RMS_Volts_Ln_1_Min': 123.4,
'RMS_Volts_Ln_1_MinTime': 1721756041299,
'Start_Date': 'Tue Jul 23 2024 17:30:13 +0000 UTC',
'Start_Time_Stamp_UTC_ms': 1721755813009}]
RMS_Volts_Ln_1_Average: 123.58
array(1) {
[0]=>
object(stdClass)#1 (16) {
["End_Time_Stamp_UTC_ms"]=>
int(1721756699097)
["Start_Time_Stamp_UTC_ms"]=>
int(1721755813009)
["End_Date"]=>
string(34) "Tue Jul 23 2024 17:44:59 +0000 UTC"
["Start_Date"]=>
string(34) "Tue Jul 23 2024 17:30:13 +0000 UTC"
["Meter"]=>
int(17507)
["Protocol"]=>
string(2) "v3"
["Count"]=>
int(270)
["RMS_Volts_Ln_1_First"]=>
float(123.5)
["RMS_Volts_Ln_1_Last"]=>
float(123.6)
["RMS_Volts_Ln_1_Min"]=>
float(123.4)
["RMS_Volts_Ln_1_Max"]=>
float(123.7)
["RMS_Volts_Ln_1_Average"]=>
float(123.58)
["RMS_Volts_Ln_1_MinTime"]=>
int(1721756041299)
["RMS_Volts_Ln_1_MaxTime"]=>
int(1721755833225)
["RMS_Volts_Ln_1_DeltaMin"]=>
float(-0.1)
["RMS_Volts_Ln_1_DeltaMax"]=>
float(0.2)
}
}
RMS_Volts_Ln_1_Average: 123.58
$VAR1 = [
{
'RMS_Volts_Ln_1_Max' => '123.5',
'RMS_Volts_Ln_1_DeltaMin' => '-0.2',
'End_Date' => 'Tue Jul 23 2024 22:29:55 +0000 UTC',
'RMS_Volts_Ln_1_Min' => '123.1',
'RMS_Volts_Ln_1_Average' => '123.36',
'Start_Date' => 'Tue Jul 23 2024 22:15:05 +0000 UTC',
'RMS_Volts_Ln_1_MaxTime' => '1721772920483',
'RMS_Volts_Ln_1_DeltaMax' => '0.2',
'Count' => 253,
'Start_Time_Stamp_UTC_ms' => '1721772905540',
'RMS_Volts_Ln_1_First' => '123.3',
'RMS_Volts_Ln_1_MinTime' => '1721773562483',
'Meter' => 17507,
'Protocol' => 'v3',
'RMS_Volts_Ln_1_Last' => '123.5',
'End_Time_Stamp_UTC_ms' => '1721773795733'
}
];
RMS_Volts_Ln_1_Average: 123.36
[{
"RMS_Volts_Ln_1_MaxTime": 1721772920483,
"Start_Time_Stamp_UTC_ms": 1721772905540,
"Meter": 17507,
"RMS_Volts_Ln_1_Last": 123.5,
"End_Time_Stamp_UTC_ms": 1721773795733,
"RMS_Volts_Ln_1_Min": 123.1,
"Count": 253,
"End_Date": "Tue Jul 23 2024 22:29:55 +0000 UTC",
"RMS_Volts_Ln_1_Average": 123.36,
"RMS_Volts_Ln_1_DeltaMax": 0.2,
"RMS_Volts_Ln_1_First": 123.3,
"RMS_Volts_Ln_1_MinTime": 1721773562483,
"Start_Date": "Tue Jul 23 2024 22:15:05 +0000 UTC",
"Protocol": "v3",
"RMS_Volts_Ln_1_Max": 123.5,
"RMS_Volts_Ln_1_DeltaMin": -0.2
}]
RMS_Volts_Ln_1_Average: 123.36
[
{
"End_Time_Stamp_UTC_ms": 1721773795733,
"Start_Time_Stamp_UTC_ms": 1721772905540,
"End_Date": "Tue Jul 23 2024 22:29:55 +0000 UTC",
"Start_Date": "Tue Jul 23 2024 22:15:05 +0000 UTC",
"Meter": 17507,
"Protocol": "v3",
"Count": 253,
"RMS_Volts_Ln_1_First": 123.3,
"RMS_Volts_Ln_1_Last": 123.5,
"RMS_Volts_Ln_1_Min": 123.1,
"RMS_Volts_Ln_1_Max": 123.5,
"RMS_Volts_Ln_1_Average": 123.36,
"RMS_Volts_Ln_1_MinTime": 1721773562483,
"RMS_Volts_Ln_1_MaxTime": 1721772920483,
"RMS_Volts_Ln_1_DeltaMin": -0.2,
"RMS_Volts_Ln_1_DeltaMax": 0.2
}
]
RMS_Volts_Ln_1_Average: 123.36
[
{
End_Time_Stamp_UTC_ms: 1721775594020,
Start_Time_Stamp_UTC_ms: 1721774702484,
End_Date: 'Tue Jul 23 2024 22:59:54 +0000 UTC',
Start_Date: 'Tue Jul 23 2024 22:45:02 +0000 UTC',
Meter: 17507,
Protocol: 'v3',
Count: 258,
RMS_Volts_Ln_1_First: 123.5,
RMS_Volts_Ln_1_Last: 123.3,
RMS_Volts_Ln_1_Min: 123.2,
RMS_Volts_Ln_1_Max: 123.5,
RMS_Volts_Ln_1_Average: 123.3,
RMS_Volts_Ln_1_MinTime: 1721774956218,
RMS_Volts_Ln_1_MaxTime: 1721774702484,
RMS_Volts_Ln_1_DeltaMin: -0.1,
RMS_Volts_Ln_1_DeltaMax: 0.1
}
]
RMS_Volts_Ln_1_Average: 123.3
All Meter Summary v2 requests will begin with the following base URL:
https://summary.ekmpush.com/summary/api/v2/meter?
The details you provide, including the meter address ID (e.g., 17507), your EKM Push Key (e.g., MTAxMDoyMDIw), and any other relevant information, will be appended to this base URL.
Here is an example of what a typical Meter Summary v2 URL might look like:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=1&fields=RMS_Volts_Ln_1
An example of the information included in a typical HTTPS call is as follows:
HTTPS Address | Description |
---|---|
https://summary. |
Base URL for the meter summary v2 requests. |
devices | Parameter to specify a particular meter. |
17507 | Meter address identifier. |
key | Parameter to include the API key. |
MTAxMDoyMDIw | EKM Push authorization key assigned to the meter. |
format | Parameter to define the file format of the response. |
html | Specifies the format of the returned data (HTML, JSON, CSV). |
report | Parameter to select a specific time period for the report. |
15 | This will display results in 15-minute summary increments, which is also the default time period the Summary API uses to return results if the report parameter is not specified. |
limit | Parameter to limit the number of rows in the report. |
1 | Limits the summary report to one (1) row, with the default being ten (10) rows if not specified. |
field | Parameter to select specific fields in the report. |
RMS_Volts_Ln_1 | Type of field to display in the summary results. This partial name ‘RMS_Volts_Ln_1’ will include all values in that field. For example, calling the RMS_Volts_Ln_1 parameter will include the _Average, _DeltaMin, _DeltaMax, _Min, _Max, _MinTime, _MaxTime, _First, and _Last values for the associated field. |
ioStack - HTTPS Request
Summary API request example
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?' \
'devices=55555&key=MTAxMDoyMDIw&format=json&' \
'report=15&limit=1&fields=Analog_In_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
# This example digs deeper into the JSON and displays the first
# Analog_In_1_Max value for the first summary read
summary = api_object[0]
analog_in_1_max = summary['Analog_In_1_Max']
pp "Analog_In_1_Max: #{analog_in_1_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"
"/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&"
"format=json&report=15&limit=1&fields=Analog_In_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)
# This example digs deeper into the JSON and displays the first
# Analog_In_1_Max value for the first summary read
summary = api_object[0]
analog_in_1_max = summary['Analog_In_1_Max']
print("Analog_In_1_Max: ", analog_in_1_max)
<?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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=1&' .
'fields=Analog_In_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 example digs deeper into the JSON and displays the first
// Analog_In_1_Max value for the first summary read
$summary = $apiObject[0];
$analog_in_1_max = $summary->Analog_In_1_Max;
echo "Analog_In_1_Max: $analog_in_1_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=1&' .
'fields=Analog_In_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)
# This example digs deeper into the JSON and displays the first
# Analog_In_1_Max value for the first summary read
my $summary = $api_object->[0];
my $analog_in_1_max = $summary->{Analog_In_1_Max};
print "Analog_In_1_Max: $analog_in_1_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
String apiUrl = "https://summary.ekmpush.com/summary/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&" +
"format=json&report=15&limit=1&" +
"fields=Analog_In_1";
JSONArray apiObject = EKM.callApi(apiUrl);
// 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
// Analog_In_1_Max value for the first summary read
JSONObject summary = apiObject.getJSONObject(0);
Object analogIn1Max = summary.get("Analog_In_1_Max");
System.out.println("Analog_In_1_Max: " + analogIn1Max);
}
}
<!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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=Analog_In_1",
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
// Analog_In_1_Max value for the first summary read
summary = apiObject[0];
analog_in_1_max = summary["Analog_In_1_Max"];
document.getElementById("analog_in_1_max").innerHTML =
"<pre>Analog_In_1_Max: " + analog_in_1_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="analog_in_1_max"></div>
</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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json' +
'&report=15&limit=1&fields=Analog_In_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);
// This example digs deeper into the JSON and displays the
// Analog_In_1_Max value for the first summary read
const summary = apiResData[0];
const analogIn1Max = summary.Analog_In_1_Max;
console.log(`Analog_In_1_Max: ${analogIn1Max}`);
} catch (error) {
console.error(error.message);
}
})();
The above example returns the following results:
[
{
"End_Time_Stamp_UTC_ms":1706129098012,
"Start_Time_Stamp_UTC_ms":1706128201790,
"End_Date":"Wed Jan 24 2024 20:44:58 +0000 UTC",
"Start_Date":"Wed Jan 24 2024 20:30:01 +0000 UTC",
"ioStack":55555,
"Protocol":"io1",
"Count":330,
"Analog_In_1_Average":1271.09,
"Analog_In_1_DeltaMin":-46,
"Analog_In_1_DeltaMax":45,
"Analog_In_1_Min":1235,
"Analog_In_1_Max":1308,
"Analog_In_1_MinTime":1706128352576,
"Analog_In_1_MaxTime":1706128737993,
"Analog_In_1_First":1278,
"Analog_In_1_Last":1261
}
]
[{"End_Time_Stamp_UTC_ms"=>1706129098012,
"Start_Time_Stamp_UTC_ms"=>1706128201790,
"End_Date"=>"Wed Jan 24 2024 20:44:58 +0000 UTC",
"Start_Date"=>"Wed Jan 24 2024 20:30:01 +0000 UTC",
"ioStack"=>55555,
"Protocol"=>"io1",
"Count"=>330,
"Analog_In_1_Average"=>1271.09,
"Analog_In_1_DeltaMin"=>-46,
"Analog_In_1_DeltaMax"=>45,
"Analog_In_1_Min"=>1235,
"Analog_In_1_Max"=>1308,
"Analog_In_1_MinTime"=>1706128352576,
"Analog_In_1_MaxTime"=>1706128737993,
"Analog_In_1_First"=>1278,
"Analog_In_1_Last"=>1261}]
"Analog_In_1_Max: 1308"
[{'Analog_In_1_Average': 1271.8,
'Analog_In_1_DeltaMax': 43,
'Analog_In_1_DeltaMin': -51,
'Analog_In_1_First': 1272,
'Analog_In_1_Last': 1269,
'Analog_In_1_Max': 1323,
'Analog_In_1_MaxTime': 1706129434027,
'Analog_In_1_Min': 1230,
'Analog_In_1_MinTime': 1706129453089,
'Count': 313,
'End_Date': 'Wed Jan 24 2024 20:59:59 +0000 UTC',
'End_Time_Stamp_UTC_ms': 1706129999408,
'ioStack': 55555,
'Protocol': 'io1',
'Start_Date': 'Wed Jan 24 2024 20:45:00 +0000 UTC',
'Start_Time_Stamp_UTC_ms': 1706129100183}]
Analog_In_1_Max: 1323
array(1) {
[0]=>
object(stdClass)#1 (16) {
["End_Time_Stamp_UTC_ms"]=>
int(1706142367395)
["Start_Time_Stamp_UTC_ms"]=>
int(1706141704559)
["End_Date"]=>
string(34) "Thu Jan 25 2024 00:26:07 +0000 UTC"
["Start_Date"]=>
string(34) "Thu Jan 25 2024 00:15:04 +0000 UTC"
["ioStack"]=>
int(55555)
["Protocol"]=>
string(3) "io1"
["Count"]=>
int(254)
["Analog_In_1_Average"]=>
float(1270.85)
["Analog_In_1_DeltaMin"]=>
int(-43)
["Analog_In_1_DeltaMax"]=>
int(48)
["Analog_In_1_Min"]=>
int(1238)
["Analog_In_1_Max"]=>
int(1309)
["Analog_In_1_MinTime"]=>
int(1706142240874)
["Analog_In_1_MaxTime"]=>
int(1706142231939)
["Analog_In_1_First"]=>
int(1293)
["Analog_In_1_Last"]=>
int(1273)
}
}
Analog_In_1_Max: 1309
$VAR1 = [
{
'Analog_In_1_DeltaMax' => 48,
'Analog_In_1_MinTime' => '1706142240874',
'Analog_In_1_Max' => 1309,
'Count' => 254,
'End_Time_Stamp_UTC_ms' => '1706142367395',
'Start_Date' => 'Thu Jan 25 2024 00:15:04 +0000 UTC',
'ioStack' => 55555,
'Analog_In_1_MaxTime' => '1706142231939',
'Start_Time_Stamp_UTC_ms' => '1706141704559',
'Analog_In_1_DeltaMin' => -43,
'End_Date' => 'Thu Jan 25 2024 00:26:07 +0000 UTC',
'Analog_In_1_First' => 1293,
'Analog_In_1_Last' => 1273,
'Analog_In_1_Average' => '1270.85',
'Analog_In_1_Min' => 1238,
'Protocol' => 'io1'
}
];
Analog_In_1_Max: 1309
[{
"Analog_In_1_DeltaMin": -43,
"Start_Time_Stamp_UTC_ms": 1706141704559,
"ioStack": 55555,
"Analog_In_1_Average": 1270.85,
"End_Time_Stamp_UTC_ms": 1706142367395,
"Analog_In_1_Min": 1238,
"Count": 254,
"End_Date": "Thu Jan 25 2024 00:26:07 +0000 UTC",
"Analog_In_1_MaxTime": 1706142231939,
"Analog_In_1_DeltaMax": 48,
"Analog_In_1_Last": 1273,
"Analog_In_1_MinTime": 1706142240874,
"Analog_In_1_Max": 1309,
"Analog_In_1_First": 1293,
"Start_Date": "Thu Jan 25 2024 00:15:04 +0000 UTC",
"Protocol": "io1"
}]
Analog_In_1_Max: 1309
[
{
"End_Time_Stamp_UTC_ms": 1706142367395,
"Start_Time_Stamp_UTC_ms": 1706141704559,
"End_Date": "Thu Jan 25 2024 00:26:07 +0000 UTC",
"Start_Date": "Thu Jan 25 2024 00:15:04 +0000 UTC",
"ioStack": 55555,
"Protocol": "io1",
"Count": 254,
"Analog_In_1_Average": 1270.85,
"Analog_In_1_DeltaMin": -43,
"Analog_In_1_DeltaMax": 48,
"Analog_In_1_Min": 1238,
"Analog_In_1_Max": 1309,
"Analog_In_1_MinTime": 1706142240874,
"Analog_In_1_MaxTime": 1706142231939,
"Analog_In_1_First": 1293,
"Analog_In_1_Last": 1273
}
]
Analog_In_1_Max: 1309
[
{
End_Time_Stamp_UTC_ms: 1706143499763,
Start_Time_Stamp_UTC_ms: 1706142665587,
End_Date: 'Thu Jan 25 2024 00:44:59 +0000 UTC',
Start_Date: 'Thu Jan 25 2024 00:31:05 +0000 UTC',
ioStack: 55555,
Protocol: 'io1',
Count: 312,
Analog_In_1_Average: 1270.04,
Analog_In_1_DeltaMin: -49,
Analog_In_1_DeltaMax: 40,
Analog_In_1_Min: 1230,
Analog_In_1_Max: 1312,
Analog_In_1_MinTime: 1706143198511,
Analog_In_1_MaxTime: 1706142899845,
Analog_In_1_First: 1279,
Analog_In_1_Last: 1263
}
]
Analog_In_1_Max: 1312
All ioStack summary v2 requests will start with the following information in the https address:
https://summary.ekmpush.com/summary/api/v2/iostack?
The information you provide, such as the ioStack address ID (i.e., 55555), your EKM Push Key (i.e., MTAxMDoyMDIw), and any other relevant details, will follow the initial https address.
Below is an example of what a typical ioStack summary v2 https address will look like:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=1&fields=Analog_In_1
Example of the information that is in a typical https call is as follows:
HTTPS Address | Description |
---|---|
https://summary. |
Start of the https address for ioStack summary v2. |
devices | Parameter for making a call to a specific ioStack. |
55555 | ioStack address to call. |
key | Parameter for calling the key. |
MTAxMDoyMDIw | EKM Push authorization key that is assigned to the ioStack device. |
format | Parameter for specifying the desired file format to be returned |
html | Language format to return the data as (HTML, JSON, CSV) |
report | Parameter for calling a specific time period |
15 | This will display results in 15-minute summary increments, which is also the default time period the Summary API uses to return results if the report parameter is not specified. |
limit | Parameter that sets the number of rows to show in the report |
1 | This will display only one (1) row in the summary report. The default is ten (10) rows, which will appear in the report if the limit parameter is not specified. |
field | Parameter for calling specific fields in the report |
Analog_In_1 | Type of field to display in the summary results. This partial name 'Analog_In_1’ will include all values in that field. For example, calling the Analog_In_1 parameter will include the _Average, _DeltaMin, _DeltaMax, _Min, _Max, _MinTime, _MaxTime, _First, and _Last values for the associated field. |
Number and Key
The EKM Summary Device Number refers to a specific device (meter or ioStack) in your service. Throughout the examples in this Summary API document, we will consistently use the address 17507 for meter devices and 55555 for ioStack devices in our HTTPS calls. To use your own meter or ioStack address, simply substitute the provided examples with your unique device address.
Similarly, the EKM Summary Key serves as the Authorization Key, identical to the one you obtained for your Realtime EKM Push Account. In the examples within this Summary API document, we will use the key MTAxMDoyMDIw for our HTTPS calls. Ensure you replace the sample key, MTAxMDoyMDIw, with your individual private key to gain access to the meters or ioStacks associated with your account.
Get a Specific Device
This section demonstrates how to retrieve detailed information about a specific device.
Meter - Get a specific device
Get a Specific meter
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=300000369&key=MTExOjExMQ&format=json&limit=5&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?' \
'devices=300000369&key=MTExOjExMQ&' \
'format=json&limit=5&fields=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.10.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/api/v2/meter\
?devices=300000369&key=MTExOjExMQ&format=json&limit=5&fields=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.1.2 (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/api/v2/meter?' .
'devices=300000369&key=MTExOjExMQ&' .
'format=json&limit=5&fields=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/api/v2/meter?' .
'devices=300000369&key=MTExOjExMQ&' .
'format=json&limit=5&fields=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.11" 2024-04-16
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/api/v2/meter?"+
"devices=300000369&key=MTExOjExMQ&"+
"format=json&limit=5&fields=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/api/v2/meter?devices=300000369&key=MTExOjExMQ&format=json&limit=5&fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=300000369&key=MTExOjExMQ&' +
'&format=json&limit=5&fields=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);
}
})();
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 docs will use the key MTAxMDoyMDIw and a v3 meter.
If you would like to filter to just 1 meter you can add the filter: devices=METER_ID
In the example below the METER_ID being used is: 300000369
https://summary.ekmpush.com/summary/api/v2/meter?devices=
300000369
&key=MTExOjExMQ&format=html&limit=5&fields=RMS_Volts_Ln_1
The link provided below serves as an illustration of the read data associated with the respective meter:
https://summary.ekmpush.com/summary/api/v2/meter?devices=300000369&key=MTExOjExMQ&format=html&limit=5&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
devices | The ID or address of the meter device you want to retrieve |
ioStack - Get a specific device
Get a Specific ioStack
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?' \
'devices=55555&key=MTAxMDoyMDIw&' \
'format=json&report=15&limit=5&' \
'fields=Analog_In_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/api/v2/iostack\
?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=5&\
fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=5&' .
'fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=5&' .
'fields=Analog_In_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&"+
"format=json&report=15&limit=5&"+
"fields=Analog_In_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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=Analog_In_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&' +
'&format=json&report=15&limit=5&fields=Analog_In_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);
}
})();
In the provided example, we use the key MTAxMDoyMDIw and the ioStack address 55555.
For filtering to a single ioStack, you can include the filter: devices=IOSTACK_ID
.
In the example below the IOSTACK_ID being used is: 55555
https://summary.ekmpush.com/summary/api/v2/iostack?devices=
55555
&key=MTAxMDoyMDIw&format=html&limit=5&fields=Analog_In_1
The link provided below serves as an illustration of the read data associated with the respective ioStack:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&limit=5&fields=Analog_In_1
URL Parameters
Parameter | Description |
---|---|
devices | The ID or address of the ioStack device you want to retrieve |
Query Multiple Devices
To retrieve data for multiple devices, utilize a tilde (~
) between their identifiers when making the call. Following this, you can refer to some examples for clarification.
Query Multiple Meters
Query Multiple meters
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507~350006960&key=MTAxMDoyMDIw&format=json&limit=5&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507~350006960'\
'&key=MTAxMDoyMDIw&format=json&limit=5&fields=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.10.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/api/v2/meter\
?devices=17507~350006960&key=MTAxMDoyMDIw&format=json&\
limit=5&fields=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.1.2 (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/api/v2/meter?' .
'devices=17507~350006960&key=MTAxMDoyMDIw&' .
'format=json&limit=5&fields=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/api/v2/meter?' .
'devices=17507~350006960&key=MTAxMDoyMDIw&' .
'format=json&limit=5&fields=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.12" 2024-07-16
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/api/v2/meter?"+
"devices=17507~350006960&key=MTAxMDoyMDIw&"+
"format=json&limit=5&fields=RMS_Volts_Ln_1");
// 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/api/v2/meter?devices=17507~350006960&key=MTAxMDoyMDIw&format=json&limit=5&fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507~350006960&key=MTAxMDoyMDIw&' +
'format=json&limit=5&fields=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);
}
})();
To view summaries for multiple meter devices, like meter numbers 17507 and 350006960, format your HTTPS address like this:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507~350006960&key=MTAxMDoyMDIw&format=html&limit=5&fields=RMS_Volts_Ln_1
As shown in the example above, the only change to the HTTPS address is adding another meter to the address parameter: 17507~350006960. This allows you to query multiple meter devices and retrieve their individual data readings.
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507~350006960&key=MTAxMDoyMDIw&format=html&limit=5&fields=RMS_Volts_Ln_1
Query Multiple ioStacks
Query Multiple ioStacks
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55553~55555&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55553~55555'\
'&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=Analog_In_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/api/v2/iostack\
?devices=55553~55555&key=MTAxMDoyMDIw&format=json&\
report=15&limit=5&fields=Analog_In_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/api/v2/iostack?' .
'devices=55553~55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=5&' .
'fields=Analog_In_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/api/v2/iostack?' .
'devices=55553~55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&limit=5&' .
'fields=Analog_In_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/api/v2/iostack?"+
"devices=55553~55555&key=MTAxMDoyMDIw&"+
"format=json&report=15&limit=5&"+
"fields=Analog_In_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/api/v2/iostack?devices=55553~55555&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=Analog_In_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/api/v2/iostack',
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('?devices=55553~55555&key=MTAxMDoyMDIw&' +
'&format=json&report=15&limit=5&fields=Analog_In_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);
}
})();
To view summaries for multiple ioStack devices, such as ioStack numbers 55553 and 55555, structure your HTTPS address as follows:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55553~55555&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=Analog_In_1
As evident in the example above, the only modification made to the HTTPS address is the inclusion of an additional ioStack at the end of the address parameter: 55553~55555. This enables you to query multiple ioStack devices and retrieve their individual data readings.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55553~55555&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=Analog_In_1
Output Formats
Meter - Output Formats
Output format: JSON
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
The above URL returns JSON structured like this:
[
{
"End_Time_Stamp_UTC_ms": 1722878098028,
"Start_Time_Stamp_UTC_ms": 1722877200260,
"End_Date": "Mon Aug 05 2024 17:14:58 +0000 UTC",
"Start_Date": "Mon Aug 05 2024 17:00:00 +0000 UTC",
"Meter": 17507,
"Protocol": "v3",
"Count": 289,
"RMS_Volts_Ln_1_First": 123.6,
"RMS_Volts_Ln_1_Last": 123.6,
"RMS_Volts_Ln_1_Min": 122.7,
"RMS_Volts_Ln_1_Max": 123.7,
"RMS_Volts_Ln_1_Average": 123.42,
"RMS_Volts_Ln_1_MinTime": 1722877770122,
"RMS_Volts_Ln_1_MaxTime": 1722877229621,
"RMS_Volts_Ln_1_DeltaMin": -0.6,
"RMS_Volts_Ln_1_DeltaMax": 0.5
}
]
Output format: CSV
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
The above URL returns CSV structured like this:
"End_Time_Stamp_UTC_ms","Start_Time_Stamp_UTC_ms","End_Date","Start_Date","Meter","Protocol","Count","RMS_Volts_Ln_1_First","RMS_Volts_Ln_1_Last","RMS_Volts_Ln_1_Min","RMS_Volts_Ln_1_Max","RMS_Volts_Ln_1_Average","RMS_Volts_Ln_1_MinTime","RMS_Volts_Ln_1_MaxTime","RMS_Volts_Ln_1_DeltaMin","RMS_Volts_Ln_1_DeltaMax"
1722878098028,1722877200260,"Mon Aug 05 2024 17:14:58 +0000 UTC","Mon Aug 05 2024 17:00:00 +0000 UTC",17507,"v3",289,123.6,123.6,122.7,123.7,123.42,1722877770122,1722877229621,-0.6,0.5
You can call up different output formats to return the summary results in. These formats can be: HTML, 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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=
FORMAT
&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
The example below will return the meter data in the HTML format. ( HyperText Markup Language )
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
Click the link below to see the meter data returned in the JSON format. ( JavaScript Object Notation )
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
Click the link below to see the meter data returned in the CSV format. ( Comma Separated Values )
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
format | Available formats are: html, json, and csv |
ioStack - Output formats
Output format: JSON
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=Analog_In_1
The above URL returns JSON structured like this:
[
{
"End_Time_Stamp_UTC_ms": 1706647499362,
"Start_Time_Stamp_UTC_ms": 1706646604925,
"End_Date": "Tue Jan 30 2024 20:44:59 +0000 UTC",
"Start_Date": "Tue Jan 30 2024 20:30:04 +0000 UTC",
"ioStack": 55555,
"Protocol": "io1",
"Count": 335,
"Analog_In_1_Average": 1271.5,
"Analog_In_1_DeltaMin": -43,
"Analog_In_1_DeltaMax": 44,
"Analog_In_1_Min": 1243,
"Analog_In_1_Max": 1311,
"Analog_In_1_MinTime": 1706647057346,
"Analog_In_1_MaxTime": 1706646804361,
"Analog_In_1_First": 1276,
"Analog_In_1_Last": 1260
}
]
Output format: CSV
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=Analog_In_1
The above URL returns CSV structured like this:
"End_Time_Stamp_UTC_ms","Start_Time_Stamp_UTC_ms","End_Date","Start_Date","ioStack","Protocol","Count","Analog_In_1_Average","Analog_In_1_DeltaMin","Analog_In_1_DeltaMax","Analog_In_1_Min","Analog_In_1_Max","Analog_In_1_MinTime","Analog_In_1_MaxTime","Analog_In_1_First","Analog_In_1_Last"
1706647499362,1706646604925,"Tue Jan 30 2024 20:44:59 +0000 UTC","Tue Jan 30 2024 20:30:04 +0000 UTC",55555,"io1",335,1271.5,-43,44,1243,1311,1706647057346,1706646804361,1276,1260
You can request the summary results in various output formats, including HTML, JSON, and CSV. To obtain a different format, simply modify the FORMAT to the desired type.
Example URL
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=
FORMAT
&report=15&limit=1&timelimit=1&fields=Analog_In_1
The example below will return the ioStack data in the HTML format. ( HyperText Markup Language )
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=1&timelimit=1&fields=Analog_In_1
Click the link below to see the ioStack data returned in the JSON format. ( JavaScript Object Notation )
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=1&timelimit=1&fields=Analog_In_1
Click the link below to see the ioStack data returned in the CSV format. ( Comma Separated Values )
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=csv&report=15&limit=1&timelimit=1&fields=Analog_In_1
URL Parameters
Parameter | Description |
---|---|
format | Available formats are: html, json, and csv |
History Reports
The report parameter defines the time period for which the summary results are returned.
Meter - Reports
Report
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=30&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507'\
'&key=MTAxMDoyMDIw&format=json&report=30&fields=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.10.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/api/v2/meter\
?devices=17507&key=MTAxMDoyMDIw&format=json&report=30&fields=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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&' .
'format=json&report=30&fields=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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&' .
'format=json&report=30&fields=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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&"+
"format=json&report=30&fields=RMS_Volts_Ln_1");
// 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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=30&fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&' +
'&format=json&report=30&fields=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 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, 30 is for a 30 minutes 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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=
REPORT
&fields=RMS_Volts_Ln_1
Example for the 15 minute summary report:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=15&fields=RMS_Volts_Ln_1
Example for the 30 minute summary report:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=30&fields=RMS_Volts_Ln_1
Example for the hr
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&fields=RMS_Volts_Ln_1
Example for the dy
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=dy&fields=RMS_Volts_Ln_1
Example for the wk
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&fields=RMS_Volts_Ln_1
Example for the mo
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=mo&fields=RMS_Volts_Ln_1
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=
mo#
&fields=RMS_Volts_Ln_1
Example for the monthly range
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=mo15&fields=RMS_Volts_Ln_1
Example for range
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=range&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
report | 15, 30, hr, dy, wk, mo, mo#, range |
ioStack - Reports
Report
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555'\
'&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_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/api/v2/iostack\
?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&' .
'format=json&report=15&fields=Analog_In_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&"+
"format=json&report=15&fields=Analog_In_1");
// 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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&' +
'&format=json&report=15&fields=Analog_In_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 available parameters are as follows: 15 for a 15-minute summary report, hr for an hourly summary report, dy for a daily summary report, wk for a weekly summary report, and mo for a monthly summary report. The range parameter is used to aggregate all summaries within the set date range into one summary report.
Replace REPORT with one of the report parameters to specify the desired ioStack reading interval
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=
REPORT
&fields=Analog_In_1
Example for the 15 minute summary report:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1
Example for the hr
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&fields=Analog_In_1
Example for the dy
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=dy&fields=Analog_In_1
Example for the wk
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=wk&fields=Analog_In_1
Example for the mo
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=mo&fields=Analog_In_1
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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=
mo#
&fields=Analog_In_1
Example for the monthly range
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=mo15&fields=Analog_In_1
Example for range
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=range&fields=Analog_In_1
URL Parameters
Parameter | Description |
---|---|
report | 15, 30, hr, dy, wk, mo, mo#, range |
Other Reports
This section introduces various types of reports accessible through the V2 API.
Meter First/Last
First/Last API request example
curl -s "https://summary.ekmpush.com/summary/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json&timezone=America~New_york"
# 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/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635'\
'&report=both&format=json&timezone=America~New_york')
# 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/api/v2/fl\
?key=MTAxMDoyMDIw&meters=17507,15635\
&report=both&format=json&timezone=America~New_york")
# 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/api/v2/fl
?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json&timezone=America~New_york');
// 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/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json&timezone=America~New_york'
);
# 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/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json&timezone=America~New_york");
/*
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));
}
}
/*
* Requirements
* NodeJS: v16.14.2
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/fl',
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('?key=MTAxMDoyMDIw&meters=17507,15635' +
'&report=both&format=json&timezone=America~New_york');
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);
}
})();
<!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/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json&timezone=America~New_york',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>
All First/Last requests will commence with the following details in the HTTPS address:
https://summary.ekmpush.com/summary/api/v2/fl?
The information you provide, such as your EKM Push Key (i.e., MTAxMDoyMDIw), and all other relevant details will follow the HTTPS address.
Below is an example of what a typical First/Last HTTPS address will look like:
https://summary.ekmpush.com/summary/api/v2/fl?key=MTAxMDoyMDIw&meters=17507,15635&report=both&format=json
URL Parameters
Parameter | Description |
---|---|
meters | [1 or more] The number of the meter you want to retrieve (required, no default, multiple meters can be separated by , optional) |
report | [first/last/both] first = If you only want the first reported time of a meter or group of meters last = If you only want the last reported time of a meter or group of meters both = If you want the first and last reported times of a meter or group of meters |
format | [html, json or csv] The format to output the summary data as: html, json or csv |
ioStack First/Last
First/Last API request example
curl -s "https://summary.ekmpush.com/summary/api/v2/fl?key=MTAxMDoyMDIw&iostacks=55553,55555&report=both&format=json"
# 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/api/v2/fl?key=MTAxMDoyMDIw&'\
'iostacks=55553,55555&report=both&format=json')
# 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/api/v2/fl\
?key=MTAxMDoyMDIw&iostacks=55553,55555&\
report=both&format=json")
# 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.ekmmetering.com/summary/api/v2/fl
?key=MTAxMDoyMDIw&iostacks=55553,55555&report=both&format=json');
// 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.ekmmetering.com/summary/api/v2/fl'
. '?key=MTAxMDoyMDIw&iostacks=55553,55555'
. '&report=both&format=json'
);
# 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.ekmmetering.com/summary/api/v2/fl"
+ "?key=MTAxMDoyMDIw&iostacks=55553,55555&"
+ "report=both&format=json"
);
/*
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));
}
}
/*
* Requirements
* NodeJS: v20.10.0
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmmetering.com/summary/api/v2/fl',
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('?key=MTAxMDoyMDIw&iostacks=55553,55555&' +
'report=both&format=json');
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);
}
})();
<!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.ekmmetering.com/summary/api/v2/fl" +
"?key=MTAxMDoyMDIw&iostacks=55553,55555" +
"&report=both&format=json",
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>
If you want to retrieve the first, the last, or both reports for your ioStack(s), you need the following endpoint:
https://summary.ekmpush.com/summary/api/v2/fl?
Below is an example of what a typical First/Last HTTPS address will look like:
https://summary.ekmpush.com/summary/api/v2/fl?key=MTAxMDoyMDIw&iostacks=55553,55555&report=both&format=json
URL Parameters
Parameter | Description |
---|---|
iostacks | [1 or more] The number of the ioStack you want to retrieve (required, no default, multiple ioStacks can be separated by , optional) |
report | [first/last/both] first = If you only want the first reported time of an ioStack or group of ioStacks last = If you only want the last reported time of an ioStack or group of ioStacks both = If you want the first and last reported times of an ioStack or group of ioStacks |
format | [html, json or csv] The format to output the summary data as: html, json or csv |
Gateway Reports
Gateway Reports API request example
curl -s "https://summary.ekmpush.com/summary/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json"
# 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/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json')
# 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.10.6
'''
# 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/api/v2/gstat\
?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json")
# 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.1.2 (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/api/v2/gstat
?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json');
// 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.34
# 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/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json'
);
# 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/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json");
/*
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));
}
}
/*
* Requirements
* NodeJS: v16.19.0
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/gstat',
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('?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json');
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);
}
})();
<!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/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=json',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>
The above example returns the following results:
[{"mac_address":"4016fa050ecd","key":"NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ","notify_email":"-","adminui_email":"info@ekmmetering.com","adminui_send_notice":true,"account_type":"Development","account_host":"appsrv.ekmmetering.com","purchase_date":" Sep 01 2022","mount_point":"/dev/mmcblk0p1","total_space":31154688,"free_space":3125408,"percent_used":90,"mem_available":272688,"load_avg":0.71,"ip_address":"DHCP 192.168.50.224","wan_ip_address":"-","eth0":1,"wlan0":"-","bandwidth":460000,"led_status":"running","reads":1,"summary":1,"devices":5,"last_reported":"Tue Apr 11 2023 12:54:44 UTC","last_reported_min":39,"last_good_time":"Tue Apr 11 2023 12:54:44 UTC","last_good_time_min":39,"uptime":30030,"ekmpush_version":"1.6815","ekmpushupdater_version":"0.0803","recovery_version":"1.6796"}]
[{"mac_address"=>"4016fa050ecd",
"key"=>"NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ",
"notify_email"=>"-",
"adminui_email"=>"info@ekmmetering.com",
"adminui_send_notice"=>true,
"account_type"=>"Development",
"account_host"=>"appsrv.ekmmetering.com",
"purchase_date"=>" Sep 01 2022",
"mount_point"=>"/dev/mmcblk0p1",
"total_space"=>31154688,
"free_space"=>3123904,
"percent_used"=>90,
"mem_available"=>272524,
"load_avg"=>0.66,
"ip_address"=>"DHCP 192.168.50.224",
"wan_ip_address"=>"-",
"led_status"=>"running",
"reads"=>1,
"summary"=>1,
"devices"=>5,
"last_reported"=>"Tue Apr 11 2023 01:09:52 UTC",
"last_reported_min"=>33,
"last_good_time"=>"Tue Apr 11 2023 01:09:52 UTC",
"last_good_time_min"=>33,
"uptime"=>30046,
"ekmpush_version"=>"1.6815",
"ekmpushupdater_version"=>"0.0803",
"recovery_version"=>"1.6796"}]
[{'account_host': 'appsrv.ekmmetering.com',
'account_type': 'Development',
'adminui_email': 'info@ekmmetering.com',
'adminui_send_notice': True,
'bandwidth': 542000,
'devices': 5,
'ekmpush_version': '1.6815',
'ekmpushupdater_version': '0.0803',
'eth0': 1,
'free_space': 3122080,
'ip_address': 'DHCP 192.168.50.224',
'key': 'NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ',
'last_good_time': 'Tue Apr 11 2023 01:25:04 UTC',
'last_good_time_min': 29,
'last_reported': 'Tue Apr 11 2023 01:25:04 UTC',
'last_reported_min': 29,
'led_status': 'running',
'load_avg': 0.77,
'mac_address': '4016fa050ecd',
'mem_available': 272500,
'mount_point': '/dev/mmcblk0p1',
'notify_email': '-',
'percent_used': 90,
'purchase_date': ' Sep 01 2022',
'reads': 1,
'recovery_version': '1.6796',
'summary': 1,
'total_space': 31154688,
'uptime': 30061,
'wan_ip_address': '-',
'wlan0': '-'}]
array(1) {
[0]=>
object(stdClass)#1 (31) {
["mac_address"]=>
string(12) "4016fa050ecd"
["key"]=>
string(36) "NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ"
["notify_email"]=>
string(1) "-"
["adminui_email"]=>
string(20) "info@ekmmetering.com"
["adminui_send_notice"]=>
bool(true)
["account_type"]=>
string(11) "Development"
["account_host"]=>
string(22) "appsrv.ekmmetering.com"
["purchase_date"]=>
string(12) " Sep 01 2022"
["mount_point"]=>
string(14) "/dev/mmcblk0p1"
["total_space"]=>
int(31154688)
["free_space"]=>
int(3122080)
["percent_used"]=>
int(90)
["mem_available"]=>
int(272500)
["load_avg"]=>
float(0.77)
["ip_address"]=>
string(19) "DHCP 192.168.50.224"
["wan_ip_address"]=>
string(1) "-"
["eth0"]=>
int(1)
["wlan0"]=>
string(1) "-"
["bandwidth"]=>
int(542000)
["led_status"]=>
string(7) "running"
["reads"]=>
int(1)
["summary"]=>
int(1)
["devices"]=>
int(5)
["last_reported"]=>
string(28) "Tue Apr 11 2023 01:25:04 UTC"
["last_reported_min"]=>
int(35)
["last_good_time"]=>
string(28) "Tue Apr 11 2023 01:25:04 UTC"
["last_good_time_min"]=>
int(35)
["uptime"]=>
int(30061)
["ekmpush_version"]=>
string(6) "1.6815"
["ekmpushupdater_version"]=>
string(6) "0.0803"
["recovery_version"]=>
string(6) "1.6796"
}
}
$VAR1 = [
{
'uptime' => 30030,
'last_reported_min' => 39,
'ekmpush_version' => '1.6815',
'notify_email' => '-',
'last_good_time_min' => 39,
'ip_address' => 'DHCP 192.168.50.224',
'last_good_time' => 'Tue Apr 11 2023 12:54:44 UTC',
'mount_point' => '/dev/mmcblk0p1',
'mac_address' => '4016fa050ecd',
'account_host' => 'appsrv.ekmmetering.com',
'load_avg' => '0.71',
'free_space' => 3125408,
'percent_used' => 90,
'total_space' => 31154688,
'wan_ip_address' => '-',
'key' => 'NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ',
'adminui_email' => 'info@ekmmetering.com',
'adminui_send_notice' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'bandwidth' => 460000,
'led_status' => 'running',
'summary' => 1,
'purchase_date' => ' Sep 01 2022',
'mem_available' => 272688,
'eth0' => 1,
'wlan0' => '-',
'last_reported' => 'Tue Apr 11 2023 12:54:44 UTC',
'devices' => 5,
'ekmpushupdater_version' => '0.0803',
'reads' => 1,
'recovery_version' => '1.6796',
'account_type' => 'Development'
}
];
[{
"account_type": "Development",
"led_status": "running",
"last_reported_min": 37,
"wlan0": "-",
"mac_address": "4016fa050ecd",
"last_reported": "Tue Apr 11 2023 01:40:14 UTC",
"total_space": 31154688,
"eth0": 1,
"notify_email": "-",
"last_good_time": "Tue Apr 11 2023 01:40:14 UTC",
"mem_available": 272844,
"key": "NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ",
"adminui_send_notice": true,
"summary": 1,
"last_good_time_min": 37,
"ekmpush_version": "1.6815",
"bandwidth": 387000,
"devices": 5,
"recovery_version": "1.6796",
"adminui_email": "info@ekmmetering.com",
"mount_point": "/dev/mmcblk0p1",
"reads": 1,
"ekmpushupdater_version": "0.0803",
"ip_address": "DHCP 192.168.50.224",
"uptime": 30076,
"percent_used": 90,
"account_host": "appsrv.ekmmetering.com",
"purchase_date": " Sep 01 2022",
"free_space": 3120352,
"load_avg": 0.68,
"wan_ip_address": "-"
}]
[
{
mac_address: '4016fa050ecd',
key: 'NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ',
notify_email: '-',
adminui_email: 'info@ekmmetering.com',
adminui_send_notice: true,
account_type: 'Development',
account_host: 'appsrv.ekmmetering.com',
purchase_date: ' Sep 01 2022',
mount_point: '/dev/mmcblk0p1',
total_space: 31154688,
free_space: 3118560,
percent_used: 90,
mem_available: 271928,
load_avg: 0.63,
ip_address: 'DHCP 192.168.50.224',
wan_ip_address: '-',
eth0: 1,
wlan0: '-',
bandwidth: 362000,
led_status: 'running',
reads: 1,
summary: 1,
devices: 5,
last_reported: 'Tue Apr 11 2023 01:55:23 UTC',
last_reported_min: 34,
last_good_time: 'Tue Apr 11 2023 01:55:23 UTC',
last_good_time_min: 34,
uptime: 30091,
ekmpush_version: '1.6815',
ekmpushupdater_version: '0.0803',
recovery_version: '1.6796'
}
]
[
{
"mac_address": "4016fa050ecd",
"key": "NjUzni10MzP6KDiyBvqXLUpqRTFmaDBrYTlJ",
"notify_email": "-",
"adminui_email": "info@ekmmetering.com",
"adminui_send_notice": true,
"account_type": "Development",
"account_host": "appsrv.ekmmetering.com",
"purchase_date": " Sep 01 2022",
"mount_point": "/dev/mmcblk0p1",
"total_space": 31154688,
"free_space": 3125408,
"percent_used": 90,
"mem_available": 272688,
"load_avg": 0.71,
"ip_address": "DHCP 192.168.50.224",
"wan_ip_address": "-",
"eth0": 1,
"wlan0": "-",
"bandwidth": 460000,
"led_status": "running",
"reads": 1,
"summary": 1,
"devices": 5,
"last_reported": "Tue Apr 11 2023 12:54:44 UTC",
"last_reported_min": 37,
"last_good_time": "Tue Apr 11 2023 12:54:44 UTC",
"last_good_time_min": 37,
"uptime": 30030,
"ekmpush_version": "1.6815",
"ekmpushupdater_version": "0.0803",
"recovery_version": "1.6796"
}
]
This endpoint is for getting the status report of one or more gateways. This tool helps users see if or when their device goes offline, debug why, and to send an email notice when it happens.
All Gateway Reports (GStat) requests will start with the following HTTPS address:
https://summary.ekmpush.com/summary/api/v2/gstat?
The information you provide, including your EKM Push Key (e.g., MTAxMDoyMDIw), and all other relevant details will follow the HTTPS address.
The example below illustrates a typical GStat HTTPS address:
https://summary.ekmpush.com/summary/api/v2/gstat?key=MTAxMDoyMDIw&mac=4016fa050ecd&format=html
URL Parameters
Parameter | Description |
---|---|
key | This could be the account or device key (does not work with meter key). |
mac | Gateway MAC address (gets just the requested gateway that matches that MAC, if the key is valid). If you do not use the MAC, the request will display all gateways associated with the specified key. |
time | This is a number of minutes that will be used as a filter to display only gateways that have connected to the internet and reported to the server within the last N minutes. |
offline | This is a number, given in minutes, to display the devices that have been offline for a period of N time. |
notify | true or false. (Show only the gateways that have a notification email set). |
type | Production, Development, Staging, Locked. (Show only gateways of a certain account_type). |
sortBy | Sort the gateway list by the specified object key. See below for a list of object keys. |
orderBy | 1 or -1. Orders the sorted list 1 - ascending -1 - descending |
limit | A number for how many rows to return. |
skip | A number for how many rows to skip. |
format | [html, json or csv] The format to output the summary data as: HTML, JSON or CSV |
Number of Summaries
In this section, you’ll discover a guide on how to get a specific number of readings from meters or ioStack devices. The guide provides clear instructions and examples to simplify the process of retrieving the required data from these devices. Whether you’re dealing with meters or ioStack devices, this resource aims to offer straightforward and helpful information for obtaining the desired readings.
Meter - Number of Summaries
Number of Summaries
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507'\
'&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20')
# 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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20")
# 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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20');
// 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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20'
);
# 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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&fields=RMS_Volts_Ln_1&limit=20");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&" +
"fields=RMS_Volts_Ln_1&limit=20",
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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&' +
'fields=RMS_Volts_Ln_1&limit=20');
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1&limit=
LIMIT
Replace LIMIT with the number 20 to call the number of rows to display in the summary results:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1&limit=20
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1&limit=20
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1&limit=1
or for 1000 rows replace LIMIT with the number 1000 as in the example below:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1&limit=1000
URL Parameters
Parameters | Description |
---|---|
limit | Number of rows to display in the summary results page |
ioStack - Number of Summaries
Number of Summaries
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555'\
'&key=MTAxMDoyMDIw&format=json&report=15&limit=20&'\
'timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&\
timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&' .
'timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&' .
'timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&"+
"timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&" +
"report=15&limit=20&timezone=America~Los_Angeles&" +
"fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=20&' +
'timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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 specifies the quantity of rows to display in the summary results. If the limit parameter is absent from the URL, it will default to the number of rows shown on the results page, which is 10 (ten) rows by default. If your summary report yields more rows than the default limit, you must set the desired number of rows using the limit parameter. If you stick with the default, not all queried results will be visible in your summary.
The limit value can vary between 1 and the total number of summary rows you wish to showcase.
The following is an example of how your HTTPS address will appear when using the limit parameter:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=
LIMIT
&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
Replace LIMIT with the number 20 to specify the quantity of rows to display in the summary results:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
The link below will display an example of the ioStack data associated with the provided key and the specified limit of 20 summary rows on the results page, presenting it as HTML data:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=1&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
or for 1000 rows replace LIMIT with the number 1000 as in the example below:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=1000&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
URL Parameters
Parameters | Description |
---|---|
limit | Number of rows, ranging from 1 to 1000, to display on the summary results page. |
Offset & Timelimit
The offset parameter is utilized for pagination in the summary results, while the timelimit parameter is used to calculate the default start_date.
Meter - Offset
Offset
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&limit=10&offset=0&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&limit=10&offset=0&fields=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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&limit=10&offset=0&fields=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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=10&offset=
OFFSET
&fields=RMS_Volts_Ln_1
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=10&offset=0&fields=RMS_Volts_Ln_1
URL Parameter
Parameter | Description |
---|---|
offset | Any number from zero ( 0 ) to the number needed |
ioStack - Offset
Offset
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=Analog_In_1~Pulse_Cnt_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&limit=10&'\
'offset=0&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&\
offset=0&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' .
'offset=0&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' .
'offset=0&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&"+
"offset=0&fields=Analog_In_1~Pulse_Cnt_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&" +
"offset=0&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' +
'offset=0&fields=Analog_In_1~Pulse_Cnt_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 can be set to zero (0) or any number greater. The default is zero (0) if not specified in the HTTPS address.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=
OFFSET
&fields=Analog_In_1~Pulse_Cnt_1
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&fields=Analog_In_1~Pulse_Cnt_1
URL Parameter
Parameter | Description |
---|---|
offset | Any number from zero ( 0 ) to the number needed |
Meter - Timelimit
Timelimit
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&report=hr&limit=10&'\
'fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5')
# 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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&\
timelimit=5&end_date=202402011200&fields=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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&' .
'fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5');
// 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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&' .
'fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5');
# 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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&"+
"fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&" +
"fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5",
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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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(
'?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=10&' +
'fields=RMS_Volts_Ln_1&end_date=202402011200&timelimit=5');
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=
TIMELIMIT
&fields=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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=5&fields=RMS_Volts_Ln_1
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=10&timelimit=5&end_date=202402011200&fields=RMS_Volts_Ln_1
URL Parameter
Parameter | Description |
---|---|
timelimit | Any number from one ( 1 ) to the number needed |
ioStack Timelimit
Timelimit
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&fields=Analog_In_1&end_date=202402011200&timelimit=5"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=hr&'\
'fields=Analog_In_1&end_date=202402011200&timelimit=5')
# 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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&\
fields=Analog_In_1&end_date=202402011200&timelimit=5")
# 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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&' .
'fields=Analog_In_1&end_date=202402011200&timelimit=5');
// 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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&' .
'fields=Analog_In_1&end_date=202402011200&timelimit=5');
# 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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&"+
"fields=Analog_In_1&end_date=202402011200&timelimit=5");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&" +
"fields=Analog_In_1&end_date=202402011200&timelimit=5",
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/api/v2/iostack',
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(
'?devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&' +
'fields=Analog_In_1&end_date=202402011200&timelimit=5');
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 serves solely to compute the default start_date. The value specified in the timelimit parameter is deducted from the end_date.
For instance, if you establish the timelimit as 5, the default start_date will commence 5 hours prior to the end_date. If the end_date is 12:00 P.M., the start_date will initiate at 7:00 A.M. Subsequently, your summary results will commence from that moment.
The timelimit parameter can be either 1 or any positive integer.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&timelimit=
TIMELIMIT
&fields=Analog_In_1
In the next case, we will use 'timelimit = 5,’ indicating the retrieval of data from 5 hours prior to the current time:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&fields=Analog_In_1&timelimit=5
If you wish to set a specific end_date, such as 202402011200, and retrieve data from 5 hours before that time, you need to make the request as follows:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&fields=Analog_In_1&end_date=202402011200&timelimit=5
URL Parameter
Parameter | Description |
---|---|
timelimit | Any number from one ( 1 ) to the number needed |
Time Zones
By default, the Summary Time Zone parameter will provide the time in milliseconds in UTC Time (computer time) and display it in the standard time format.
Visit the link below to access the Wikipedia database containing information about time zones and related details:
Click for Time Zone Information
Meter - Time Zones
Time Zones
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&timezone=America~Los_Angeles&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&timelimit=5&'\
'timezone=America~Los_Angeles&fields=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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&\
timezone=America~Los_Angeles&fields=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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&' .
'timezone=America~Los_Angeles&fields=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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&' .
'timezone=America~Los_Angeles&fields=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.12" 2024-07-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&"+
"timezone=America~Los_Angeles&fields=RMS_Volts_Ln_1");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&" +
"timezone=America~Los_Angeles&fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&timelimit=5&' +
'timezone=America~Los_Angeles&fields=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);
}
})();
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&timelimit=5&timezone=
TIME_ZONE
&fields=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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&timelimit=5&timezone=America~Los_Angeles&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
timezone | The time zone is the country and city where the meter is in service. Example: America~Los_Angeles. |
ioStack - Time Zones
Time Zones
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&'\
'timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&\
offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' .
'offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' .
'offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&"+
"offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&" +
"offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=10&' +
'offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_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);
}
})();
If you want the time in a specific time zone, you can include that information in the URL.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=
TIME_ZONE
&fields=Analog_In_1~Pulse_Cnt_1
In the following example, the TIME_ZONE specified for the request is associated with the country of America, and the specific city where the ioStack is operational is Los Angeles.
The time zone for this location will align with the PACIFIC TIME ZONE, featuring a UTC offset of -8:00.
The provided link below will generate an HTML request corresponding to the specified parameters in the HTTPS address:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=Analog_In_1~Pulse_Cnt_1
Please follow the link below to access the Wikipedia database for information on time zones and related details.
Click for Time Zone Information
URL Parameters
Parameter | Description |
---|---|
timezone | The time zone corresponds to the country and city where ioStack is operational. For example: America~Los_Angeles. |
Start Date & End Date
This section provides the option to request existing summary reports for a specific meter or ioStack on a designated date.
Meter - Start Date & End Date
Start Date & End Date
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&start_date=202405010900&end_date=202405020800&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&report=hr&limit=25&'\
'start_date=202405010900&end_date=202405020800&'\
'fields=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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&\
start_date=202405010900&end_date=202405020800&fields=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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' .
'start_date=202405010900&end_date=202405020800&fields=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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' .
'start_date=202405010900&end_date=202405020800&fields=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.12 2024-07-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&"+
"start_date=202405010900&end_date=202405020800&fields=RMS_Volts_Ln_1");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&" +
"start_date=202405010900&end_date=202405020800&fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' +
'start_date=202405010900&end_date=202405020800&fields=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 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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&start_date=
YYYYMMDDhhmm
&end_date=
YYYYMMDDhhmm
&fields=RMS_Volts_Ln_1
Date Parameters
Parameters | Description |
---|---|
YYYY | Indicates the year to be called. example: 2024 |
MM | Indicates the month to be called. Example: 05, for the month of May |
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 May 01, 2024 9:00 A.M. to May 02, 2024 8:00 A.M.. Your https address should look like the following:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&start_date=202405010900&end_date=202405020800&fields=RMS_Volts_Ln_1
Click the link below to see an example.
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=range&start_date=202405010900&end_date=202405020800&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
start_date | Date for the summary report to begin. Example of YYYYMMDDhhmm is as follows: 202405010900 = May 01, 2024 9:00 A.M. |
end_date | Data for the summary report to end. Example of YYYYMMDDhhmm is as follows: 202405020800 = May 02, 2024 8:00 A.M. |
ioStack - Start Date & End Date
Start Date & End Date
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=hr&limit=25&'\
'timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&'\
'fields=Analog_In_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&\
timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&\
fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' .
'timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&' .
'fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' .
'timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&' .
'fields=Analog_In_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&"+
"timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&" +
"fields=Analog_In_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&" +
"timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&" +
"fields=Analog_In_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&' +
'timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&' +
'fields=Analog_In_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 request existing summary reports for a specific ioStack on a designated date using the provided URL parameters:
https://summary.ekmpush.com/summary/api/v2/iostack?
devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&
timezone=America~Los_Angeles&start_date=
YYYYMMDDhhmm
&end_date=
YYYYMMDDhhmm
&fields=Analog_In_1
Date Parameters
Parameters | Description |
---|---|
YYYY | Indicates the year to be called. example: 2024 |
MM | Indicates the month to be called. Example: 01, for the month of January |
DD | Indicates the day of the month. Example: 05, for the fifth 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 January 05, 2024 9:00 A.M. to January 06, 2024 8:00 A.M.. Your https address should look like the following:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&fields=Analog_In_1
Click the link below to see an example.
The “range” parameter is utilized to amalgamate all summaries falling within the specified date range into a unified summary report.
Example of the range parameter for the report:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=range&timezone=America~Los_Angeles&start_date=202401050900&end_date=202401060800&fields=Analog_In_1
URL Parameters
Parameter | Description |
---|---|
start_date | Date for the summary report to begin. Example of YYYYMMDDhhmm is as follows: 202401050900 = January 05, 2024 9:00 A.M. |
end_date | Data for the summary report to end. Example of YYYYMMDDhhmm is as follows: 202401060800 = January 06, 2024 8:00 A.M. |
Hours
Get summary results for a specific device by choosing a time within today.
Meter - Hours
Hours
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&fields=RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&hours=1300-1530&'\
'fields=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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&\
fields=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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&' .
'fields=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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&' .
'fields=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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&"+
"fields=RMS_Volts_Ln_1");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&" +
"fields=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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&hours=1300-1530&' +
'fields=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 also retrieve all available summary results for a given meter by a specified time, either for the current period or for a time range selected by the customer, using 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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&hours=
hhmm
-
hhmm
&fields=RMS_Volts_Ln_1
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&hours=1300-1530&fields=RMS_Volts_Ln_1
URL Parameters
Parameter | Description |
---|---|
hours | The Format in which the Time is written in: hhmm - hours, minutes. Example: 1530 for 3:30 P.M. |
ioStack - Hours
Hours
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=Analog_In_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&'\
'fields=Analog_In_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&\
fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&' .
'fields=Analog_In_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&' .
'fields=Analog_In_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&"+
"fields=Analog_In_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&" +
"fields=Analog_In_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&' +
'fields=Analog_In_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 retrieve the available summary results for a specific ioStack by specifying the time within the current day using the following https ‘hours’ parameter. This parameter is utilized to display summary reports between the provided start and end hours. For example: 1300-1530.
hours: hhmm-hhmm ( default 0000-2359 from 00:00 to 23:59 hours )
Time parameters will adhere to the 24-hour clock format, also known as military time.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&hours=
hhmm
-
hhmm
&fields=Analog_In_1
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 view an example:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=Analog_In_1
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
The ‘days’ parameter works similarly to the 'hours’ parameter but is used to examine field values on specific days rather than at specific hours.
Meter - Days
Days
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&fields=RMS_Volts_Ln_1&days=mon"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&report=wk&'\
'fields=RMS_Volts_Ln_1&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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&\
fields=RMS_Volts_Ln_1&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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&' .
'fields=RMS_Volts_Ln_1&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.0
# 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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&' .
'fields=RMS_Volts_Ln_1&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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&"+
"fields=RMS_Volts_Ln_1&days=mon");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&" +
"fields=RMS_Volts_Ln_1&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: v20.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&report=wk&' +
'fields=RMS_Volts_Ln_1&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);
}
})();
Here is an example of an HTTPS request used to fetch summary data with the 'days’ parameter:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=RMS_Volts_Ln_1&days=
DAYS
Simply replace DAYS with a specific day of the week.
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=15&fields=RMS_Volts_Ln_1&days=mon
If you want to set more than one day, just use a tilde (~) between each of the days you want to include in the URL:
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=15&limit=500&fields=RMS_Volts_Ln_1&days=mon~tue~wed
Click the link below to see an example.
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&report=wk&fields=RMS_Volts_Ln_1&days=mon
Days Parameters
Parameters | Description |
---|---|
mon | Monday |
tue | Tuesday |
wed | Wednesday |
thu | Thursday |
fri | Friday |
sat | Saturday |
sun | Sunday |
ioStack - Days
Days
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_1&days=mon"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&'\
'fields=Analog_In_1&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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&\
fields=Analog_In_1&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.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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'fields=Analog_In_1&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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'fields=Analog_In_1&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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&"+
"fields=Analog_In_1&days=mon");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&" +
"fields=Analog_In_1&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: v20.10.0
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' +
'fields=Analog_In_1&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);
}
})();
Here’s an example of how an HTTPS request looks when fetching summary data using the 'days’ parameter.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1&days=
DAYS
Just replace DAYS with a day of the week.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1&days=mon
If you wish to include more than one day, simply use a tilde (~) between each of the desired days in the URL:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=500&fields=Analog_In_1&days=mon~tue~wed
Click the link below to see an example.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1&days=mon
Days Parameters
Parameters | Description |
---|---|
mon | Monday |
tue | Tuesday |
wed | Wednesday |
thu | Thursday |
fri | Friday |
sat | Saturday |
sun | Sunday |
Fields
This section is designed to display specific fields and avoid loading all of them. Some fields might be unnecessary for certain requests, so you can use filters to show only the ones you need.
Meter - Fields
Fields
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&fields=kWh_Tot~RMS_Volts_Ln_1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&'\
'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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&\
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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&' .
'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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&' .
'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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&"+
"fields=kWh_Tot~RMS_Volts_Ln_1");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&" +
"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.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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('?devices=17507&key=MTAxMDoyMDIw&format=json&' +
'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);
}
})();
To show only the summary fields you want, use the fields=
FIELDS
parameter in the URL.
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=kWh_Tot~RMS_Volts_Ln_1
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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=kWh_Tot,RMS_Volts_Ln_1
If you do not want all the field results in your query or are only interested in specific field values, you can request them using the complete field name:
Example: RMS_Volts_Ln_1_Average
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=RMS_Volts_Ln_1_Average
Example: kWh_Tot_DeltaMax
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=kWh_Tot_DeltaMax
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~RMS_Volts_Ln_1_Average
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&fields=kWh_Tot_DeltaMax~RMS_Volts_Ln_1_Average
If you use fields=all
, it will show all fields, regardless of whether the meter has any data for them, and it will display the empty fields with a value of 0.
Example: all
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=1&fields=all
To create a query without aggregating any fields and displaying only the header fields, such as count
, timestamps
, and similar metadata, you can use fields=none
. This parameter ensures that no specific data fields are included in the results, providing a concise overview with just the essential summary information.
Example: none
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=5&fields=none
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
Field | Description | ||
---|---|---|---|
kWh_Tot* | Total Kilowatt Hour | ||
|
kWh_Tariff_1* | Kilowatt Hour for Tariff 1 | ||
|
kWh_Tariff_2* | Kilowatt Hour for Tariff 2 | ||
|
kWh_Tariff_3* | Kilowatt Hour for Tariff 3 | ||
|
kWh_Tariff_4* | Kilowatt Hour for Tariff 4 | ||
|
Rev_kWh_Tot* | Total Reverse Kilowatt Hour | ||
|
Rev_kWh_Tariff_1* | Reverse Kilowatt Hour for Tariff 1 | ||
|
Rev_kWh_Tariff_2* | Reverse Kilowatt Hour for Tariff 2 | ||
|
Rev_kWh_Tariff_3* | Reverse Kilowatt Hour for Tariff 3 | ||
|
Rev_kWh_Tariff_4* | Reverse Kilowatt Hour for Tariff 4 | ||
|
RMS_Volts_Ln_1* | Root-Mean-Squared Volts on Ln 1 | ||
|
RMS_Volts_Ln_2* | Root-Mean-Squared Volts on line 2 | ||
|
RMS_Volts_Ln_3* | Root-Mean-Squared Volts on line 3 | ||
|
Amps_Ln_1* | Amps on line 1 | ||
|
Amps_Ln_2* | Amps on line 2 | ||
|
Amps_Ln_3* | Amps on line 3 | ||
|
RMS Watts_Ln_1* | Root-Mean-Squared Watts on line 1 | ||
|
RMS Watts_Ln_2* | Root-Mean-Squared Watts on line 2 | ||
|
RMS Watts_Ln_3* | Root-Mean-Squared Watts on line 3 | ||
|
RMS Watts_Tot* | Total Root-Mean-Squared Watts all lines | ||
|
Power_Factor_Ln_1* | Power Factor on line 1 | ||
|
Power_Factor_Ln_2* | Power Factor on line 2 | ||
|
Power_Factor_Ln_3* | Power Factor on line 3 | ||
|
RMS_Watts_ |
Root-Mean-Squared Watts Max Demand | ||
|
Max Demand Period | |||
|
CT_Ratio* | Current Transformer Ratio | ||
|
The fields below are additional Summary fields only for v4 and v5 meters
Pulse_Cnt_1* | Pulse Count on Input 1 | ||
|
Pulse_Cnt_2* | Pulse Count on Input 2 | ||
|
Pulse_Cnt_3* | Pulse Count on Input 3 | ||
|
Pulse_Ratio_1* | Pulse Input Ratio on Input 1 | ||
|
Pulse_Ratio_2* | Pulse Input Ratio on Input 2 | ||
|
Pulse_Ratio_3* | Pulse Input Ratio on Input 3 | ||
|
Reactive_Energy_Tot* | Total Kilo Volt Amperes Reactive Hours (kVARh) | ||
|
kWh_Rst* | Resettable Kilowatt Hour | ||
|
Rev_kWh_Rst* | Resettable Reverse Kilowatt Hour | ||
|
Reactive_Pwr_Ln_1* | Volt-Amperes Reactive on line 1 | ||
|
Reactive_Pwr_Ln_2* | Volt-Amperes Reactive on line 2 | ||
|
Reactive_Pwr_Ln_3* | Volt-Amperes Reactive on line 3 | ||
|
Reactive_Pwr_Tot* | Total Volt-Amperes Reactive | ||
|
Line_Freq* | Frequency (Hz) | ||
|
kWh_Ln_1* | Total Kilowatt Hour on Line 1 | ||
|
kWh_Ln_2* | Total Kilowatt Hour on Line 2 | ||
|
kWh_Ln_3* | Total kilowatt Hour on Line 3 | ||
|
Rev_kWh_Ln_1* | Reverse Kilowatt Hour on Line 1 | ||
|
Rev_kWh_Ln_2* | Reverse Kilowatt Hour on Line 2 | ||
|
Rev_kWh_Ln_3* | Reverse Kilowatt Hour on Line 3 | ||
|
Max_Demand_Rst* | Max Demand Auto Reset Status OFF = 0 Monthly = 1 Weekly = 2 Daily = 3 Hourly = 4 |
||
|
Net_Calc_Watts_Ln_1* | Net Watts on Line 1 | ||
|
Net_Calc_Watts_Ln_2* | Net Watts on Line 2 | ||
|
Net_Calc_Watts_Ln_3* | Net Watts on Line 3 | ||
|
Net_Calc_Watts_Tot* | Total Net Watts | ||
|
CF_Ratio* | Settable Pulse Output Ratio (Crest Factor Ratio) | ||
|
ioStack - Fields
Fields
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&fields=Analog_In_1~Pulse_Cnt_1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&'\
'fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&\
fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&"+
"fields=Analog_In_1~Pulse_Cnt_1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&" +
"fields=Analog_In_1~Pulse_Cnt_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/api/v2/iostack',
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('?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' +
'fields=Analog_In_1~Pulse_Cnt_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);
}
})();
If you want to filter and see only specific summary details, insert 'fields=FIELDS’ into the address bar:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=
FIELDS
In the example provided, we’re specifically looking for information on 'Analog_In_1’ and 'Pulse_Cnt_1.’ To fetch the data related to these fields, use the abbreviated names after the fields parameter, separated by a tilde (~) or a comma (,) if requesting more than one field:
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1~Pulse_Cnt_1
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/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1,Pulse_Cnt_1
Including a part of the field name will display all corresponding field values linked to the specified field name.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1~Pulse_Cnt_1
If you include just a part of the name, it retrieves all the associated values linked to that specific field.
For example, when you call the field Analog_In_1, the results will include the following values:
- Analog_In_1_Average
- Analog_In_1_DeltaMin
- Analog_In_1_DeltaMax
- Analog_In_1_Min
- Analog_In_1_Max
- Analog_In_1_MinTime
- Analog_In_1_MaxTime
- Analog_In_1_First
- Analog_In_1_Last
If you prefer not to display all field results in your query or if you are only interested in a specific field value, you can specify it by adding the desired value at the end of the field’s name instead of just a part of the name.
Example: Analog_In_1_DeltaMax
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1_DeltaMax
Example: Analog_In_1_Last
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1_Last
If you wish to include multiple field values without retrieving all associated values for a given field, you should add each value to the address as if you were calling another field’s name.
Example: Analog_In_1_DeltaMax~Analog_In_1_Last
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&fields=Analog_In_1_DeltaMax~Analog_In_1_Last
If you use fields=all
, it will show all fields, regardless of whether the ioStack has any data for them, and it will display the empty fields with a value of 0.
Example: all
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&limit=1&fields=all
To create a query without aggregating any fields and displaying only the header fields, such as count
, timestamps
, and similar metadata, you can use fields=none
. This parameter ensures that no specific data fields are included in the results, providing a concise overview with just the essential summary information.
Example: none
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&limit=5&fields=none
The examples provided are not limited to just these two data fields. You have the flexibility to add either a single field or as many fields as needed to fulfill your requirements.
URL Parameters
The fields below are the Summary fields for ioStack devices
Field | Description | ||
---|---|---|---|
Analog_In_1* | Analog Input 1 | ||
|
Field | Description | ||
---|---|---|---|
Analog_In_2* | Analog Input 2 | ||
|
Field | Description | ||
---|---|---|---|
Analog_In_3* | Analog Input 3 | ||
|
Field | Description | ||
---|---|---|---|
Analog_In_4* | Analog Input 4 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_1* | Total Lifetime Pulse Count Line 1 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_2* | Total Lifetime Pulse Count Line 2 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_3* | Total Lifetime Pulse Count Line 3 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_4* | Total Lifetime Pulse Count Line 4 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_Rst_1* | Resettable Pulse Count Line 1 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_Rst_2* | Resettable Pulse Count Line 2 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_Rst_3* | Resettable Pulse Count Line 3 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Cnt_Rst_4* | Resettable Pulse Count Line 4 | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hold_ms_1* | Pulse Input 1 Hold (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hold_ms_2* | Pulse Input 2 Hold (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hold_ms_3* | Pulse Input 3 Hold (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hold_ms_4* | Pulse Input 4 Hold (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Prev_ms_1* | Pulse Input 1 Previous High (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Prev_ms_2* | Pulse Input 2 Previous High (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Prev_ms_3* | Pulse Input 3 Previous High (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Prev_ms_4* | Pulse Input 4 Previous High (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Prev_ms_1* | Pulse Input 1 Previous Low (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Prev_ms_2* | Pulse Input 2 Previous Low (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Prev_ms_3* | Pulse Input 3 Previous Low (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Prev_ms_4* | Pulse Input 4 Previous Low (milliseconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Total_sec_1* | Pulse Input 1 Total High (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Total_sec_2* | Pulse Input 2 Total High (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Total_sec_3* | Pulse Input 3 Total High (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Hi_Total_sec_4* | Pulse Input 4 Total High (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Total_sec_1* | Pulse Input 1 Total Low (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Total_sec_2* | Pulse Input 2 Total Low (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Total_sec_3* | Pulse Input 3 Total Low (seconds) | ||
|
Field | Description | ||
---|---|---|---|
Pulse_Lo_Total_sec_4* | Pulse Input 4 Total Low (seconds) | ||
|
Field | Description | ||
---|---|---|---|
OW_1_1_degC* | 1-Wire Bus 1, Slot 1: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_1_2_degC* | 1-Wire Bus 1, Slot 2: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_1_3_degC* | 1-Wire Bus 1, Slot 3: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_1_4_degC* | 1-Wire Bus 1, Slot 4: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_2_1_degC* | 1-Wire Bus 2, Slot 1: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_2_2_degC* | 1-Wire Bus 2, Slot 2: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_2_3_degC* | 1-Wire Bus 2, Slot 3: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_2_4_degC* | 1-Wire Bus 2, Slot 4: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_3_1_degC* | 1-Wire Bus 3, Slot 1: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_3_2_degC* | 1-Wire Bus 3, Slot 2: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_3_3_degC* | 1-Wire Bus 3, Slot 3: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_3_4_degC* | 1-Wire Bus 3, Slot 4: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_4_1_degC* | 1-Wire Bus 4, Slot 1: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_4_2_degC* | 1-Wire Bus 4, Slot 2: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_4_3_degC* | 1-Wire Bus 4, Slot 3: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_4_4_degC* | 1-Wire Bus 4, Slot 4: ºC | ||
|
Field | Description | ||
---|---|---|---|
OW_1_1_Humidity* | 1-Wire Bus 1, Slot 1: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_1_2_Humidity* | 1-Wire Bus 1, Slot 2: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_1_3_Humidity* | 1-Wire Bus 1, Slot 3: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_1_4_Humidity* | 1-Wire Bus 1, Slot 4: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_2_1_Humidity* | 1-Wire Bus 2, Slot 1: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_2_2_Humidity* | 1-Wire Bus 2, Slot 2: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_2_3_Humidity* | 1-Wire Bus 2, Slot 3: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_2_4_Humidity* | 1-Wire Bus 2, Slot 4: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_3_1_Humidity* | 1-Wire Bus 3, Slot 1: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_3_2_Humidity* | 1-Wire Bus 3, Slot 2: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_3_3_Humidity* | 1-Wire Bus 3, Slot 3: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_3_4_Humidity* | 1-Wire Bus 3, Slot 4: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_4_1_Humidity* | 1-Wire Bus 4, Slot 1: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_4_2_Humidity* | 1-Wire Bus 4, Slot 2: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_4_3_Humidity* | 1-Wire Bus 4, Slot 3: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_4_4_Humidity* | 1-Wire Bus 4, Slot 4: Humidity | ||
|
Field | Description | ||
---|---|---|---|
OW_1_1_Lux* | 1-Wire Bus 1, Slot 1: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_1_2_Lux* | 1-Wire Bus 1, Slot 2: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_1_3_Lux* | 1-Wire Bus 1, Slot 3: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_1_4_Lux* | 1-Wire Bus 1, Slot 4: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_2_1_Lux* | 1-Wire Bus 2, Slot 1: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_2_2_Lux* | 1-Wire Bus 2, Slot 2: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_2_3_Lux* | 1-Wire Bus 2, Slot 3: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_2_4_Lux* | 1-Wire Bus 2, Slot 4: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_3_1_Lux* | 1-Wire Bus 3, Slot 1: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_3_2_Lux* | 1-Wire Bus 3, Slot 2: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_3_3_Lux* | 1-Wire Bus 3, Slot 3: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_3_4_Lux* | 1-Wire Bus 3, Slot 4: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_4_1_Lux* | 1-Wire Bus 4, Slot 1: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_4_2_Lux* | 1-Wire Bus 4, Slot 2: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_4_3_Lux* | 1-Wire Bus 4, Slot 3: Lux | ||
|
Field | Description | ||
---|---|---|---|
OW_4_4_Lux* | 1-Wire Bus 4, Slot 4: Lux | ||
|
Normalize
The normalize parameter ensures that Start Date times and End Date times align with specified intervals based on the “report” type. Start times are rounded to the nearest :00 seconds, and end times to the nearest :59 seconds, with hours and minutes adjusting according to the “report” type parameter.
For example, with a report parameter set to 15 (15 minutes), each row in the summary report will show start times at 15-minute intervals: 09:00:00, 09:15:00, 09:30:00, etc. The corresponding end times will be 15 minutes after the start time: 09:14:59, 09:29:59, 09:44:59, etc.
If the URL lacks the normalize parameter, it defaults to zero (0). The default means summary reports won’t round start times to :00 seconds and end times to :59 seconds. To display summary reports with start times at :00 seconds and end times at :59 seconds, use the normalize parameter set to one (1).
Meter - Normalize
Normalize
curl -s "https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&fields=RMS_Volts_Ln_1&normalize=1"
# Ruby Version: 3.0.2p107
# 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/api/v2/meter?devices=17507&'\
'key=MTAxMDoyMDIw&format=json&limit=12&'\
'fields=RMS_Volts_Ln_1&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.10.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/api/v2/meter?\
devices=17507&key=MTAxMDoyMDIw&format=json&\
limit=12&fields=RMS_Volts_Ln_1&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.1.2 (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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&' .
'fields=RMS_Volts_Ln_1&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/api/v2/meter?' .
'devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&' .
'fields=RMS_Volts_Ln_1&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.11" 2024-04-16
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/api/v2/meter?"+
"devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&"+
"fields=RMS_Volts_Ln_1&normalize=1");
// 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/api/v2/meter?" +
"devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&" +
"fields=RMS_Volts_Ln_1&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: v20.15.1
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/meter',
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(
'?devices=17507&key=MTAxMDoyMDIw&format=json&limit=12&' +
'fields=RMS_Volts_Ln_1&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/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=12&fields=RMS_Volts_Ln_1&report=15&normalize=1
The example below is without the normalize parameter.
https://summary.ekmpush.com/summary/api/v2/meter?devices=17507&key=MTAxMDoyMDIw&format=html&limit=12&fields=RMS_Volts_Ln_1&report=15
ioStack - Normalize
Normalize
curl -s "https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&limit=12&fields=Analog_In_1&normalize=1"
# Ruby Version: 3.3.0
# 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/api/v2/iostack?devices=55555&'\
'key=MTAxMDoyMDIw&format=json&report=15&'\
'limit=12&fields=Analog_In_1&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/api/v2/iostack?\
devices=55555&key=MTAxMDoyMDIw&format=json&report=15&\
limit=12&fields=Analog_In_1&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.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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'limit=12&fields=Analog_In_1&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/api/v2/iostack?' .
'devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' .
'limit=12&fields=Analog_In_1&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/api/v2/iostack?"+
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&"+
"limit=12&fields=Analog_In_1&normalize=1");
// 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/api/v2/iostack?" +
"devices=55555&key=MTAxMDoyMDIw&format=json&report=15&" +
"limit=12&fields=Analog_In_1&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: v20.10.0
* Axios: 0.27.2
*/
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://summary.ekmpush.com/summary/api/v2/iostack',
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(
'?devices=55555&key=MTAxMDoyMDIw&format=json&report=15&' +
'limit=12&fields=Analog_In_1&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 following example illustrates how the HTTPS address will appear when utilizing the normalize parameter with the report type set to 15 (15 minutes).
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=12&fields=Analog_In_1&normalize=1
The example below is without the normalize parameter.
https://summary.ekmpush.com/summary/api/v2/iostack?devices=55555&key=MTAxMDoyMDIw&format=html&report=15&limit=12&fields=Analog_In_1
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, allowing continuous realtime or summary data streaming (you can stream 24/7). 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.4/v.5 Meter Settings Protocol
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.