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
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 an API Builder Tool found here:
HTTPS Request
Below, you will find a guide on how to make HTTPS requests to retrieve information from meters or ioStack devices.
Meter HTTPS Request
Meter HTTPS Request
curl -s "https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles')
# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object
# This example digs deeper into the JSON and displays the first
# kwh_tot value for the first read of the first meter
readmeter_json = api_object['readmeter']
readset_json = readmeter_json['ReadSet']
readset_0_json = readset_json[0]
readdata_json = readset_0_json['ReadData']
readdata_0_json = readdata_json[0]
kwh_tot = readdata_0_json['kWh_Tot']
pp "kWh_Tot: #{kwh_tot}"
'''
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://api.ekmpush.com/readmeter\
?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles")
# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)
# This example digs deeper into the JSON and displays the first
# kwh_tot value for the first read of the first meter
readmeter_json = api_object['readmeter']
readset_json = readmeter_json['ReadSet']
readset_0_json = readset_json[0]
readdata_json = readset_0_json['ReadData']
readdata_0_json = readdata_json[0]
kwh_tot = readdata_0_json["kWh_Tot"]
print("kWh_Tot: ", kwh_tot)
<?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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles');
// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);
// This example digs deeper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
$readmeter_json = $apiObject->readmeter;
$readset_json = $readmeter_json->ReadSet;
$readset_0_json = $readset_json[0];
$readdata_json = $readset_0_json->ReadData;
$readdata_0_json = $readdata_json[0];
$kwh_tot = $readdata_0_json->kWh_Tot;
echo "kWh_Tot: $kwh_tot";
// 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles'
);
# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object); ## no critic (InputOutput::RequireCheckedSyscalls)
# This example digs deeper into the JSON and displays the first
# kwh_tot value for the first read of the first meter
my $readmeter_json = $api_object->{readmeter};
my $readset_json = $readmeter_json->{ReadSet};
my $readset_0_json = $readset_json->[0];
my $readdata_json = $readset_0_json->{ReadData};
my $readdata_0_json = $readdata_json->[0];
my $kwh_tot = $readdata_0_json->{kWh_Tot};
print "kWh_Tot: $kwh_tot"; ## 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("https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles");
// 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 deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
JSONObject readmeterJson = apiObject.getJSONObject("readmeter");
JSONArray readsetJson = readmeterJson.getJSONArray("ReadSet");
JSONObject readset0Json = readsetJson.getJSONObject(0);
JSONArray readDataJson = readset0Json.getJSONArray("ReadData");
JSONObject readData0Json = readDataJson.getJSONObject(0);
Object kwhTot = readData0Json.get("kWh_Tot");
System.out.println("kWh_Tot: " + kwhTot); // NOPMD
}
}
<!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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles',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 example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
readmeter_json = apiObject['readmeter'];
readset_json = readmeter_json['ReadSet'];
readset_0_json = readset_json[0];
readdata_json = readset_0_json['ReadData'];
readdata_0_json = readdata_json[0];
kwh_tot = readdata_0_json["kWh_Tot"];
document.getElementById("kwh_tot").innerHTML = "<pre>kWh_Tot: "+kwh_tot+"</pre>";
});
};
// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
var jsonObject = JSON.parse(xhttp.responseText);
callback(jsonObject);
}
};
xhttp.open("GET", apiRequest, true);
xhttp.send();
}
</script>
</head>
<body onload="example()">
<div id="result"> </div>
<div id="kwh_tot"> </div>
</body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// 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&fmt=json&cnt=1&tz=America~Los_Angeles');
const apiResData = res.data;
// This gets the kWh Tot from the first read of the first ReadSet
const kWhTot = apiResData.readmeter.ReadSet[0].ReadData[0].kWh_Tot;
console.log(JSON.stringify(apiResData, null, 2));
console.log('kWh Tot: ' + kWhTot);
} catch (error) {
console.error(error.message);
}
})();
The above example returns the following results:
{
"readmeter": {
"Requested": 1,
"ReadSet": [
{
"Meter": "17507",
"Group": 0,
"Send_Interval": 60,
"Protocol": "v3",
"MAC_Addr": "40:16:fa:01:02:26",
"Tz_Offset_Sec": -25200,
"Bad_Reads": 0,
"Good_Reads": 1,
"Credits": 1000000,
"Push_Version": "Push2",
"ReadData": [
{
"Good": 1,
"Date": "2022-04-15",
"Time": "10:27:15.141",
"Time_Stamp_UTC_ms": 1650043635141,
"Firmware": "15",
"Model": "1710",
"kWh_Tot": "50986.8",
"kWh_Tariff_1": "5143.0",
"kWh_Tariff_2": "45843.8",
"Rev_kWh_Tot": "0.7",
"Rev_kWh_Tariff_1": "0.4",
"Rev_kWh_Tariff_2": "0.3",
"RMS_Volts_Ln_1": "123.5",
"RMS_Volts_Ln_2": "123.6",
"Amps_Ln_1": "4.0",
"Amps_Ln_2": "4.0",
"Power_Factor_Ln_1": "100",
"Power_Factor_Ln_2": "100",
"Power_Factor_Ln_3": "200",
"Cos_Theta_Ln_1": "1.00",
"Cos_Theta_Ln_2": "1.00",
"Cos_Theta_Ln_3": "0.00 C",
"RMS_Watts_Ln_1": "498",
"RMS_Watts_Ln_2": "498",
"RMS_Watts_Tot": "998",
"RMS_Watts_Max_Demand": "5050",
"Max_Demand_Period": "1",
"CT_Ratio": "200",
"Meter_Status_Code": "00"
}
]
}
]
}
}
{"readmeter"=>
{"Requested"=>1,
"ReadSet"=>
[{"Meter"=>"17507",
"Group"=>0,
"Send_Interval"=>60,
"Protocol"=>"v3",
"MAC_Addr"=>"40:16:fa:01:02:26",
"Tz_Offset_Sec"=>-25200,
"Bad_Reads"=>0,
"Good_Reads"=>1,
"Credits"=>1000000,
"Push_Version"=>"Push2",
"ReadData"=>
[{"Good"=>1,
"Date"=>"2022-04-15",
"Time"=>"10:27:15.141",
"Time_Stamp_UTC_ms"=>1650043635141,
"Firmware"=>"15",
"Model"=>"1710",
"kWh_Tot"=>"50986.8",
"kWh_Tariff_1"=>"5143.0",
"kWh_Tariff_2"=>"45843.8",
"Rev_kWh_Tot"=>"0.7",
"Rev_kWh_Tariff_1"=>"0.4",
"Rev_kWh_Tariff_2"=>"0.3",
"RMS_Volts_Ln_1"=>"123.5",
"RMS_Volts_Ln_2"=>"123.6",
"Amps_Ln_1"=>"4.0",
"Amps_Ln_2"=>"4.0",
"Power_Factor_Ln_1"=>"100",
"Power_Factor_Ln_2"=>"100",
"Power_Factor_Ln_3"=>"200",
"Cos_Theta_Ln_1"=>"1.00",
"Cos_Theta_Ln_2"=>"1.00",
"Cos_Theta_Ln_3"=>"0.00 C",
"RMS_Watts_Ln_1"=>"498",
"RMS_Watts_Ln_2"=>"498",
"RMS_Watts_Tot"=>"998",
"RMS_Watts_Max_Demand"=>"5050",
"Max_Demand_Period"=>"1",
"CT_Ratio"=>"200",
"Meter_Status_Code"=>"00"}]}]}}
"kWh_Tot: 50986.8"
{'readmeter': {'ReadSet': [{'Bad_Reads': 0,
'Credits': 1000000,
'Good_Reads': 1,
'Group': 0,
'MAC_Addr': '40:16:fa:01:02:26',
'Meter': '17507',
'Protocol': 'v3',
'Push_Version': 'Push2',
'ReadData': [{'Amps_Ln_1': '4.0',
'Amps_Ln_2': '4.0',
'CT_Ratio': '200',
'Cos_Theta_Ln_1': '1.00',
'Cos_Theta_Ln_2': '1.00',
'Cos_Theta_Ln_3': '0.00 C',
'Date': '2022-04-15',
'Firmware': '15',
'Good': 1,
'Max_Demand_Period': '1',
'Meter_Status_Code': '00',
'Model': '1710',
'Power_Factor_Ln_1': '100',
'Power_Factor_Ln_2': '100',
'Power_Factor_Ln_3': '200',
'RMS_Volts_Ln_1': '123.5',
'RMS_Volts_Ln_2': '123.6',
'RMS_Watts_Ln_1': '498',
'RMS_Watts_Ln_2': '498',
'RMS_Watts_Max_Demand': '5050',
'RMS_Watts_Tot': '998',
'Rev_kWh_Tariff_1': '0.4',
'Rev_kWh_Tariff_2': '0.3',
'Rev_kWh_Tot': '0.7',
'Time': '10:27:15.141',
'Time_Stamp_UTC_ms': 1650043635141,
'kWh_Tariff_1': '5143.0',
'kWh_Tariff_2': '45843.8',
'kWh_Tot': '50986.8'}],
'Send_Interval': 60,
'Tz_Offset_Sec': -25200}],
'Requested': 1}}
kWh_Tot: 50986.8
object(stdClass)#4 (1) {
["readmeter"]=>
object(stdClass)#1 (2) {
["Requested"]=>
int(1)
["ReadSet"]=>
array(1) {
[0]=>
object(stdClass)#2 (11) {
["Meter"]=>
string(5) "17507"
["Group"]=>
int(0)
["Send_Interval"]=>
int(60)
["Protocol"]=>
string(2) "v3"
["MAC_Addr"]=>
string(17) "40:16:fa:01:02:26"
["Tz_Offset_Sec"]=>
int(-25200)
["Bad_Reads"]=>
int(0)
["Good_Reads"]=>
int(1)
["Credits"]=>
int(1000000)
["Push_Version"]=>
string(5) "Push2"
["ReadData"]=>
array(1) {
[0]=>
object(stdClass)#3 (29) {
["Good"]=>
int(1)
["Date"]=>
string(10) "2022-04-15"
["Time"]=>
string(12) "10:27:15.141"
["Time_Stamp_UTC_ms"]=>
int(1650043635141)
["Firmware"]=>
string(2) "15"
["Model"]=>
string(4) "1710"
["kWh_Tot"]=>
string(7) "50986.8"
["kWh_Tariff_1"]=>
string(6) "5143.0"
["kWh_Tariff_2"]=>
string(7) "45843.8"
["Rev_kWh_Tot"]=>
string(3) "0.7"
["Rev_kWh_Tariff_1"]=>
string(3) "0.4"
["Rev_kWh_Tariff_2"]=>
string(3) "0.3"
["RMS_Volts_Ln_1"]=>
string(5) "123.5"
["RMS_Volts_Ln_2"]=>
string(5) "123.6"
["Amps_Ln_1"]=>
string(4) "4.0"
["Amps_Ln_2"]=>
string(4) "4.0"
["Power_Factor_Ln_1"]=>
string(3) "100"
["Power_Factor_Ln_2"]=>
string(3) "100"
["Power_Factor_Ln_3"]=>
string(3) "200"
["Cos_Theta_Ln_1"]=>
string(4) "1.00"
["Cos_Theta_Ln_2"]=>
string(4) "1.00"
["Cos_Theta_Ln_3"]=>
string(6) "0.00 C"
["RMS_Watts_Ln_1"]=>
string(4) "498"
["RMS_Watts_Ln_2"]=>
string(4) "498"
["RMS_Watts_Tot"]=>
string(4) "998"
["RMS_Watts_Max_Demand"]=>
string(4) "5050"
["Max_Demand_Period"]=>
string(1) "1"
["CT_Ratio"]=>
string(3) "200"
["Meter_Status_Code"]=>
string(2) "00"
}
}
}
}
}
}
kWh_Tot: 50986.8
$VAR1 = {
'readmeter' => {
'ReadSet' => [
{
'Meter' => '17507',
'Group' => 0,
'Send_Interval' => 60,
'Protocol' => 'v3',
'MAC_Addr' => '40:16:fa:01:02:26',
'Tz_Offset_Sec' => -25200,
'Bad_Reads' => 0,
'Good_Reads' => 1,
'Credits' => 1000000,
'Push_Version' => 'Push2',
'ReadData' => [
{
'Good' => 1,
'Date' => '2022-04-15',
'Time' => '10:27:15.141',
'Time_Stamp_UTC_ms' => '1650043635141',
'Firmware' => '15',
'Model' => '1710',
'kWh_Tot' => '50986.8',
'kWh_Tariff_1' => '5143.0',
'kWh_Tariff_2' => '45843.8',
'Rev_kWh_Tot' => '0.7',
'Rev_kWh_Tariff_1' => '0.4',
'Rev_kWh_Tariff_2' => '0.3',
'RMS_Volts_Ln_1' => '123.5',
'RMS_Volts_Ln_2' => '123.6',
'Amps_Ln_1' => '4.0',
'Amps_Ln_2' => '4.0',
'Power_Factor_Ln_1' => '100',
'Power_Factor_Ln_2' => '100',
'Power_Factor_Ln_3' => '200',
'Cos_Theta_Ln_1' => '1.00',
'Cos_Theta_Ln_2' => '1.00',
'Cos_Theta_Ln_3' => '0.00 C',
'RMS_Watts_Ln_1' => '498',
'RMS_Watts_Ln_2' => '498',
'RMS_Watts_Tot' => '998',
'RMS_Watts_Max_Demand' => '5050',
'Max_Demand_Period' => '1',
'CT_Ratio' => '200',
'Meter_Status_Code' => '00'
}
]
}
],
'Requested' => 1
}
};
kWh_Tot: 50986.8
{"readmeter": {
"Requested": 1,
"ReadSet": [{
"Good_Reads": 1,
"Group": 0,
"Credits": 1000000,
"Push_Version": "Push2",
"Meter": "17507",
"Bad_Reads": 0,
"Send_Interval": 60,
"Protocol": "v3",
"ReadData": [{
"kWh_Tot": "50986.8",
"Rev_kWh_Tariff_2": "0.3",
"Rev_kWh_Tariff_1": "0.4",
"Max_Demand_Period": "1",
"Time": "10:27:15.141",
"Meter_Status_Code": "00",
"Amps_Ln_1": "4.0",
"Amps_Ln_2": "4.0",
"RMS_Volts_Ln_1": "123.5",
"RMS_Volts_Ln_2": "123.6",
"RMS_Watts_Max_Demand": "5050",
"CT_Ratio": "200",
"Firmware": "15",
"RMS_Watts_Tot": "998",
"Time_Stamp_UTC_ms": 1650043635141,
"Power_Factor_Ln_3": "200",
"Power_Factor_Ln_2": "100",
"Power_Factor_Ln_1": "100",
"kWh_Tariff_2": "45843.8",
"kWh_Tariff_1": "5143.0",
"Date": "2022-04-15",
"Cos_Theta_Ln_3": "0.00 C",
"RMS_Watts_Ln_1": "498",
"Cos_Theta_Ln_2": "1.00",
"Rev_kWh_Tot": "0.7",
"Cos_Theta_Ln_1": "1.00",
"RMS_Watts_Ln_2": "498",
"Model": "1710",
"Good": 1
}],
"Tz_Offset_Sec": -25200,
"MAC_Addr": "40:16:fa:01:02:26"
}]
}}
kWh_Tot: 50986.8
{
"readmeter": {
"Requested": 1,
"ReadSet": [
{
"Meter": "17507",
"Group": 0,
"Send_Interval": 60,
"Protocol": "v3",
"MAC_Addr": "40:16:fa:01:02:26",
"Tz_Offset_Sec": -25200,
"Bad_Reads": 0,
"Good_Reads": 1,
"Credits": 1000000,
"Push_Version": "Push2",
"ReadData": [
{
"Good": 1,
"Date": "2022-04-15",
"Time": "10:27:15.141",
"Time_Stamp_UTC_ms": 1650043635141,
"Firmware": "15",
"Model": "1710",
"kWh_Tot": "50986.8",
"kWh_Tariff_1": "5143.0",
"kWh_Tariff_2": "45843.8",
"Rev_kWh_Tot": "0.7",
"Rev_kWh_Tariff_1": "0.4",
"Rev_kWh_Tariff_2": "0.3",
"RMS_Volts_Ln_1": "123.5",
"RMS_Volts_Ln_2": "123.6",
"Amps_Ln_1": "4.0",
"Amps_Ln_2": "4.0",
"Power_Factor_Ln_1": "100",
"Power_Factor_Ln_2": "100",
"Power_Factor_Ln_3": "200",
"Cos_Theta_Ln_1": "1.00",
"Cos_Theta_Ln_2": "1.00",
"Cos_Theta_Ln_3": "0.00 C",
"RMS_Watts_Ln_1": "498",
"RMS_Watts_Ln_2": "498",
"RMS_Watts_Tot": "998",
"RMS_Watts_Max_Demand": "5050",
"Max_Demand_Period": "1",
"CT_Ratio": "200",
"Meter_Status_Code": "00"
}
]
}
]
}
}
kWh_Tot: 50986.8
{
"readmeter": {
"Requested": 1,
"ReadSet": [
{
"Meter": "17507",
"Group": 0,
"Send_Interval": 60,
"Protocol": "v3",
"MAC_Addr": "40:16:fa:01:02:26",
"Tz_Offset_Sec": -25200,
"Bad_Reads": 0,
"Good_Reads": 1,
"Credits": 1000000,
"Push_Version": "Push2",
"ReadData": [
{
"Good": 1,
"Date": "2022-04-15",
"Time": "10:27:15.141",
"Time_Stamp_UTC_ms": 1650043635141,
"Firmware": "15",
"Model": "1710",
"kWh_Tot": "50986.8",
"kWh_Tariff_1": "5143.0",
"kWh_Tariff_2": "45843.8",
"Rev_kWh_Tot": "0.7",
"Rev_kWh_Tariff_1": "0.4",
"Rev_kWh_Tariff_2": "0.3",
"RMS_Volts_Ln_1": "123.5",
"RMS_Volts_Ln_2": "123.6",
"Amps_Ln_1": "4.0",
"Amps_Ln_2": "4.0",
"Power_Factor_Ln_1": "100",
"Power_Factor_Ln_2": "100",
"Power_Factor_Ln_3": "200",
"Cos_Theta_Ln_1": "1.00",
"Cos_Theta_Ln_2": "1.00",
"Cos_Theta_Ln_3": "0.00 C",
"RMS_Watts_Ln_1": "498",
"RMS_Watts_Ln_2": "498",
"RMS_Watts_Tot": "998",
"RMS_Watts_Max_Demand": "5050",
"Max_Demand_Period": "1",
"CT_Ratio": "200",
"Meter_Status_Code": "00"
}
]
}
]
}
}
kWh Tot: 50986.8
All https requests will begin with the following information in the https address:
https://api.ekmpush.com/readmeter?
The information that you provide, such as your EKM Push Key (i.e. MTAxMDoyMDIw) and all other associated information will follow the beginning https address.
Example below of what a typical realtime https address will look like:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
Example of the information that is in a typical https call is as follows:
HTTPS Address | Description |
---|---|
https:// |
Beginning of the https address |
meters | Parameter for calling the meter |
17507 | Exact meter number to call |
key | Parameter for calling the key |
MTAxMDoyMDIw | EKM Push authorization key |
fmt | Parameter expecting the file format to return as |
json | Language format to return the data as (html, xml, json, csv) |
cnt | Parameter for expecting how many meter readings to call |
1 | Exact number of meter readings |
tz | Parameter for selecting your time zone |
America~Los_Angeles | Time zone selected |
Here is an example URL:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1
ioStack HTTPS Request
ioStack HTTPS Request
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles')
# 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 value for the first read of the first IOStack
readio_json = api_object['readiostack']
readset_json = readio_json['ReadSet']
readset_0_json = readset_json[0]
readdata_json = readset_0_json['ReadData']
readdata_0_json = readdata_json[0]
analog_in_1 = readdata_0_json['Analog_In_1']
pp "Analog_In_1: #{analog_in_1}"
'''
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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles")
# 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 value for the first read of the first IOStack
readio_json = api_object['readiostack']
readset_json = readio_json['ReadSet']
readset_0_json = readset_json[0]
readdata_json = readset_0_json['ReadData']
readdata_0_json = readdata_json[0]
analog_in_1 = readdata_0_json["Analog_In_1"]
print("Analog_In_1: ", analog_in_1)
<?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://api.ekmpush.com/readiostack?' .
'address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles');
// 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 value for the first read of the first IOStack
$readio_json = $apiObject->readiostack;
$readset_json = $readio_json->ReadSet;
$readset_0_json = $readset_json[0];
$readdata_json = $readset_0_json->ReadData;
$readdata_0_json = $readdata_json[0];
$analog_in_1 = $readdata_0_json->Analog_In_1;
echo "Analog_In_1: $analog_in_1";
// 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);
return json_decode($json);
}
#!/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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles'
);
# 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 value for the first read of the first IOStack
my $readio_json = $api_object->{readiostack};
my $readset_json = $readio_json->{ReadSet};
my $readset_0_json = $readset_json->[0];
my $readdata_json = $readset_0_json->{ReadData};
my $readdata_0_json = $readdata_json->[0];
my $analog_in_1 = $readdata_0_json->{Analog_In_1};
print "Analog_In_1: $analog_in_1"; ## 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.*;
// Supress Warnings
@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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles");
// 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 value for the first read of the first IOStack
JSONObject readioJson = apiObject.getJSONObject("readiostack");
JSONArray readsetJson = readioJson.getJSONArray("ReadSet");
JSONObject readset0Json = readsetJson.getJSONObject(0);
JSONArray readDataJson = readset0Json.getJSONArray("ReadData");
JSONObject readData0Json = readDataJson.getJSONObject(0);
Object analogIn1 = readData0Json.get("Analog_In_1");
System.out.println("Analog_In_1: " + analogIn1); // NOPMD
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTTPS Request</title>
<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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles",
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 example digs deeper into the JSON and displays the first
// Analog_In_1 value for the first read of the first IOStack
let readio_json = apiObject["readiostack"];
let readset_json = readio_json["ReadSet"];
let readset_0_json = readset_json[0];
let readdata_json = readset_0_json["ReadData"];
let readdata_0_json = readdata_json[0];
let analog_in_1 = readdata_0_json["Analog_In_1"];
document.getElementById("analog_in_1").innerHTML =
"<pre>Analog_In_1: " + analog_in_1 + "</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"></div>
</body>
</html>
/*
* Requirements
* NodeJS: v20.10.0
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query
// and logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?address=55555' +
'&key=MTAxMDoyMDIw' +
'&fmt=json&cnt=1&tz=America~Los_Angeles',
);
const apiResData = res.data;
// This gets the Analog_In_1 from the first read of the first ReadSet
const analogIn1 =
apiResData.readiostack.ReadSet[0].ReadData[0].Analog_In_1;
console.log(JSON.stringify(apiResData, null, 2));
console.log('Analog_In_1: ' + analogIn1);
} catch (error) {
console.error(error.message);
}
})();
The above example returns the following results:
{
"readiostack": {
"Requested": 1,
"ReadSet": [
{
"ioStack": "55555",
"ioStack_Name": "Tank Level",
"Send_Interval": 420,
"Protocol": "1",
"MAC_Addr": "4016fa0513b3",
"Tz_Offset_Sec": -28800,
"Bad_Reads": 0,
"Good_Reads": 1,
"Push_Version": "Push3",
"Group": 0,
"Credits": 1000000,
"ReadData": [
{
"Good": 1,
"Good_Reads_Ratio": 100,
"Read_Attempts": 152,
"Date": "2024-01-17",
"Time": "13:17:41.620",
"Time_Stamp_UTC_ms": 1705526261620,
"Device_Time": "2024-01-17T09:22:23",
"Firmware": "1.42",
"Hardware_Type": 133,
"Model": 1,
"Analog_In_1": 1251,
"Analog_In_2": 1223,
"Analog_In_3": 1250,
"Analog_In_4": 1194,
"State_Inputs": 0,
"State_Out": 5,
"Pulse_Cnt_1": 37,
"Pulse_Cnt_2": 0,
"Pulse_Cnt_3": 548706,
"Pulse_Cnt_4": 3026631,
"Pulse_Cnt_Rst_1": 37,
"Pulse_Cnt_Rst_2": 0,
"Pulse_Cnt_Rst_3": 548706,
"Pulse_Cnt_Rst_4": 3026631,
"Pulse_Hold_ms_1": 6054881587,
"Pulse_Hold_ms_2": 6054881587,
"Pulse_Hold_ms_3": 6054881587,
"Pulse_Hold_ms_4": 6054881587,
"Pulse_Hi_Prev_ms_1": 0,
"Pulse_Hi_Prev_ms_2": 0,
"Pulse_Hi_Prev_ms_3": 0,
"Pulse_Hi_Prev_ms_4": 0,
"Pulse_Lo_Prev_ms_1": 0,
"Pulse_Lo_Prev_ms_2": 0,
"Pulse_Lo_Prev_ms_3": 0,
"Pulse_Lo_Prev_ms_4": 0,
"Pulse_Hi_Total_sec_1": 0,
"Pulse_Hi_Total_sec_2": 0,
"Pulse_Hi_Total_sec_3": 0,
"Pulse_Hi_Total_sec_4": 0,
"Pulse_Lo_Total_sec_1": 6054881,
"Pulse_Lo_Total_sec_2": 6054881,
"Pulse_Lo_Total_sec_3": 6054881,
"Pulse_Lo_Total_sec_4": 6054881
}
]
}
]
}
}
{"readiostack"=>
{"Requested"=>1,
"ReadSet"=>
[{"ioStack"=>"55555",
"ioStack_Name"=>"Tank Level",
"Send_Interval"=>420,
"Protocol"=>"1",
"MAC_Addr"=>"4016fa0513b3",
"Tz_Offset_Sec"=>-28800,
"Bad_Reads"=>0,
"Good_Reads"=>1,
"Push_Version"=>"Push3",
"Group"=>0,
"Credits"=>1000000,
"ReadData"=>
[{"Good"=>1,
"Good_Reads_Ratio"=>100,
"Read_Attempts"=>152,
"Date"=>"2024-01-17",
"Time"=>"13:17:41.620",
"Time_Stamp_UTC_ms"=>1705526261620,
"Device_Time"=>"2024-01-17T09:22:23",
"Firmware"=>"1.42",
"Hardware_Type"=>133,
"Model"=>1,
"Analog_In_1"=>1251,
"Analog_In_2"=>1223,
"Analog_In_3"=>1250,
"Analog_In_4"=>1194,
"State_Inputs"=>0,
"State_Out"=>5,
"Pulse_Cnt_1"=>37,
"Pulse_Cnt_2"=>0,
"Pulse_Cnt_3"=>548706,
"Pulse_Cnt_4"=>3026631,
"Pulse_Cnt_Rst_1"=>37,
"Pulse_Cnt_Rst_2"=>0,
"Pulse_Cnt_Rst_3"=>548706,
"Pulse_Cnt_Rst_4"=>3026631,
"Pulse_Hold_ms_1"=>6054881587,
"Pulse_Hold_ms_2"=>6054881587,
"Pulse_Hold_ms_3"=>6054881587,
"Pulse_Hold_ms_4"=>6054881587,
"Pulse_Hi_Prev_ms_1"=>0,
"Pulse_Hi_Prev_ms_2"=>0,
"Pulse_Hi_Prev_ms_3"=>0,
"Pulse_Hi_Prev_ms_4"=>0,
"Pulse_Lo_Prev_ms_1"=>0,
"Pulse_Lo_Prev_ms_2"=>0,
"Pulse_Lo_Prev_ms_3"=>0,
"Pulse_Lo_Prev_ms_4"=>0,
"Pulse_Hi_Total_sec_1"=>0,
"Pulse_Hi_Total_sec_2"=>0,
"Pulse_Hi_Total_sec_3"=>0,
"Pulse_Hi_Total_sec_4"=>0,
"Pulse_Lo_Total_sec_1"=>6054881,
"Pulse_Lo_Total_sec_2"=>6054881,
"Pulse_Lo_Total_sec_3"=>6054881,
"Pulse_Lo_Total_sec_4"=>6054881}]}]}}
"Analog_In_1: 1251"
{'readiostack': {'ReadSet': [{'Bad_Reads': 0,
'Credits': 1000000,
'Good_Reads': 1,
'Group': 0,
'MAC_Addr': '4016fa0513b3',
'Protocol': '1',
'Push_Version': 'Push3',
'ReadData': [{'Analog_In_1': 1264,
'Analog_In_2': 1222,
'Analog_In_3': 1399,
'Analog_In_4': 1235,
'Date': '2024-01-17',
'Device_Time': '2024-01-17T09:29:24',
'Firmware': '1.42',
'Good': 1,
'Good_Reads_Ratio': 100,
'Hardware_Type': 133,
'Model': 1,
'Pulse_Cnt_1': 37,
'Pulse_Cnt_2': 0,
'Pulse_Cnt_3': 548706,
'Pulse_Cnt_4': 3026631,
'Pulse_Cnt_Rst_1': 37,
'Pulse_Cnt_Rst_2': 0,
'Pulse_Cnt_Rst_3': 548706,
'Pulse_Cnt_Rst_4': 3026631,
'Pulse_Hi_Prev_ms_1': 0,
'Pulse_Hi_Prev_ms_2': 0,
'Pulse_Hi_Prev_ms_3': 0,
'Pulse_Hi_Prev_ms_4': 0,
'Pulse_Hi_Total_sec_1': 0,
'Pulse_Hi_Total_sec_2': 0,
'Pulse_Hi_Total_sec_3': 0,
'Pulse_Hi_Total_sec_4': 0,
'Pulse_Hold_ms_1': 6055302684,
'Pulse_Hold_ms_2': 6055302684,
'Pulse_Hold_ms_3': 6055302684,
'Pulse_Hold_ms_4': 6055302684,
'Pulse_Lo_Prev_ms_1': 0,
'Pulse_Lo_Prev_ms_2': 0,
'Pulse_Lo_Prev_ms_3': 0,
'Pulse_Lo_Prev_ms_4': 0,
'Pulse_Lo_Total_sec_1': 6055302,
'Pulse_Lo_Total_sec_2': 6055302,
'Pulse_Lo_Total_sec_3': 6055302,
'Pulse_Lo_Total_sec_4': 6055302,
'Read_Attempts': 152,
'State_Inputs': 0,
'State_Out': 5,
'Time': '13:24:42.720',
'Time_Stamp_UTC_ms': 1705526682720}],
'Send_Interval': 420,
'Tz_Offset_Sec': -28800,
'ioStack': '55555',
'ioStack_Name': 'Tank Level'}],
'Requested': 1}}
Analog_In_1: 1264
object(stdClass)#4 (1) {
["readiostack"]=>
object(stdClass)#1 (2) {
["Requested"]=>
int(1)
["ReadSet"]=>
array(1) {
[0]=>
object(stdClass)#2 (12) {
["ioStack"]=>
string(5) "55555"
["ioStack_Name"]=>
string(10) "Tank Level"
["Send_Interval"]=>
int(420)
["Protocol"]=>
string(1) "1"
["MAC_Addr"]=>
string(12) "4016fa0513b3"
["Tz_Offset_Sec"]=>
int(-28800)
["Bad_Reads"]=>
int(0)
["Good_Reads"]=>
int(1)
["Push_Version"]=>
string(5) "Push3"
["Group"]=>
int(0)
["Credits"]=>
int(1000000)
["ReadData"]=>
array(1) {
[0]=>
object(stdClass)#3 (44) {
["Good"]=>
int(1)
["Good_Reads_Ratio"]=>
int(100)
["Read_Attempts"]=>
int(152)
["Date"]=>
string(10) "2024-01-17"
["Time"]=>
string(12) "13:24:42.720"
["Time_Stamp_UTC_ms"]=>
int(1705526682720)
["Device_Time"]=>
string(19) "2024-01-17T09:29:24"
["Firmware"]=>
string(4) "1.42"
["Hardware_Type"]=>
int(133)
["Model"]=>
int(1)
["Analog_In_1"]=>
int(1264)
["Analog_In_2"]=>
int(1222)
["Analog_In_3"]=>
int(1399)
["Analog_In_4"]=>
int(1235)
["State_Inputs"]=>
int(0)
["State_Out"]=>
int(5)
["Pulse_Cnt_1"]=>
int(37)
["Pulse_Cnt_2"]=>
int(0)
["Pulse_Cnt_3"]=>
int(548706)
["Pulse_Cnt_4"]=>
int(3026631)
["Pulse_Cnt_Rst_1"]=>
int(37)
["Pulse_Cnt_Rst_2"]=>
int(0)
["Pulse_Cnt_Rst_3"]=>
int(548706)
["Pulse_Cnt_Rst_4"]=>
int(3026631)
["Pulse_Hold_ms_1"]=>
int(6055302684)
["Pulse_Hold_ms_2"]=>
int(6055302684)
["Pulse_Hold_ms_3"]=>
int(6055302684)
["Pulse_Hold_ms_4"]=>
int(6055302684)
["Pulse_Hi_Prev_ms_1"]=>
int(0)
["Pulse_Hi_Prev_ms_2"]=>
int(0)
["Pulse_Hi_Prev_ms_3"]=>
int(0)
["Pulse_Hi_Prev_ms_4"]=>
int(0)
["Pulse_Lo_Prev_ms_1"]=>
int(0)
["Pulse_Lo_Prev_ms_2"]=>
int(0)
["Pulse_Lo_Prev_ms_3"]=>
int(0)
["Pulse_Lo_Prev_ms_4"]=>
int(0)
["Pulse_Hi_Total_sec_1"]=>
int(0)
["Pulse_Hi_Total_sec_2"]=>
int(0)
["Pulse_Hi_Total_sec_3"]=>
int(0)
["Pulse_Hi_Total_sec_4"]=>
int(0)
["Pulse_Lo_Total_sec_1"]=>
int(6055302)
["Pulse_Lo_Total_sec_2"]=>
int(6055302)
["Pulse_Lo_Total_sec_3"]=>
int(6055302)
["Pulse_Lo_Total_sec_4"]=>
int(6055302)
}
}
}
}
}
}
Analog_In_1: 1264
$VAR1 = {
'readiostack' => {
'Requested' => 1,
'ReadSet' => [
{
'Good_Reads' => 1,
'Group' => 0,
'Credits' => 1000000,
'Bad_Reads' => 0,
'Tz_Offset_Sec' => -28800,
'Protocol' => '1',
'ReadData' => [
{
'Time' => '13:59:46.435',
'Pulse_Hold_ms_2' => 6057406362,
'Analog_In_4' => 1399,
'State_Inputs' => 0,
'Pulse_Hold_ms_4' => 6057406362,
'Pulse_Cnt_Rst_3' => 548706,
'Pulse_Hold_ms_1' => 6057406362,
'Pulse_Cnt_1' => 37,
'Pulse_Hi_Total_sec_1' => 0,
'Pulse_Lo_Total_sec_1' => 6057406,
'Pulse_Lo_Total_sec_3' => 6057406,
'Pulse_Hi_Total_sec_3' => 0,
'Good' => 1,
'Pulse_Lo_Prev_ms_2' => 0,
'Pulse_Hold_ms_3' => 6057406362,
'Pulse_Hi_Prev_ms_2' => 0,
'Pulse_Cnt_Rst_4' => 3026631,
'Pulse_Lo_Total_sec_4' => 6057406,
'Pulse_Hi_Total_sec_4' => 0,
'Analog_In_3' => 1337,
'Pulse_Cnt_Rst_2' => 0,
'Pulse_Lo_Total_sec_2' => 6057406,
'Time_Stamp_UTC_ms' => '1705528786435',
'Pulse_Hi_Total_sec_2' => 0,
'State_Out' => 5,
'Good_Reads_Ratio' => 100,
'Hardware_Type' => 133,
'Pulse_Hi_Prev_ms_1' => 0,
'Pulse_Lo_Prev_ms_1' => 0,
'Pulse_Cnt_2' => 0,
'Pulse_Cnt_Rst_1' => 37,
'Pulse_Cnt_4' => 3026631,
'Analog_In_1' => 1250,
'Device_Time' => '2024-01-17T10:04:27',
'Pulse_Lo_Prev_ms_3' => 0,
'Date' => '2024-01-17',
'Pulse_Hi_Prev_ms_3' => 0,
'Pulse_Cnt_3' => 548706,
'Pulse_Hi_Prev_ms_4' => 0,
'Pulse_Lo_Prev_ms_4' => 0,
'Read_Attempts' => 152,
'Firmware' => '1.42',
'Analog_In_2' => 1221,
'Model' => 1
}
],
'Send_Interval' => 420,
'Push_Version' => 'Push3',
'MAC_Addr' => '4016fa0513b3',
'ioStack_Name' => 'Tank Level',
'ioStack' => '55555'
}
]
}
};
Analog_In_1: 1250
{"readiostack": {
"Requested": 1,
"ReadSet": [{
"Good_Reads": 1,
"ioStack_Name": "Tank Level",
"Group": 0,
"ioStack": "55555",
"Push_Version": "Push3",
"Credits": 1000000,
"Bad_Reads": 0,
"Send_Interval": 420,
"Protocol": "1",
"ReadData": [{
"State_Out": 5,
"Pulse_Lo_Total_sec_2": 6056983,
"Pulse_Lo_Total_sec_1": 6056983,
"Pulse_Lo_Total_sec_4": 6056983,
"Pulse_Lo_Total_sec_3": 6056983,
"Analog_In_2": 1213,
"Analog_In_1": 1245,
"Analog_In_4": 1123,
"Analog_In_3": 1311,
"Time": "13:52:43.952",
"Pulse_Lo_Prev_ms_1": 0,
"Pulse_Lo_Prev_ms_2": 0,
"Pulse_Cnt_1": 37,
"Pulse_Cnt_2": 0,
"Pulse_Lo_Prev_ms_3": 0,
"Pulse_Cnt_3": 548706,
"Pulse_Lo_Prev_ms_4": 0,
"Pulse_Hi_Total_sec_4": 0,
"Pulse_Hi_Total_sec_3": 0,
"Pulse_Hi_Total_sec_2": 0,
"Pulse_Hi_Total_sec_1": 0,
"Firmware": "1.42",
"Pulse_Cnt_4": 3026631,
"Pulse_Hold_ms_2": 6056983884,
"Pulse_Hold_ms_1": 6056983884,
"Time_Stamp_UTC_ms": 1705528363952,
"Hardware_Type": 133,
"Pulse_Hold_ms_4": 6056983884,
"Pulse_Hold_ms_3": 6056983884,
"Pulse_Hi_Prev_ms_1": 0,
"Pulse_Hi_Prev_ms_2": 0,
"Date": "2024-01-17",
"Pulse_Hi_Prev_ms_3": 0,
"Pulse_Hi_Prev_ms_4": 0,
"Read_Attempts": 158,
"Good_Reads_Ratio": 100,
"Device_Time": "2024-01-17T09:57:25",
"Model": 1,
"Pulse_Cnt_Rst_1": 37,
"Pulse_Cnt_Rst_3": 548706,
"Pulse_Cnt_Rst_2": 0,
"Good": 1,
"State_Inputs": 0,
"Pulse_Cnt_Rst_4": 3026631
}],
"Tz_Offset_Sec": -28800,
"MAC_Addr": "4016fa0513b3"
}]
}}
Analog_In_1: 124
{
"readiostack": {
"Requested": 1,
"ReadSet": [
{
"ioStack": "55555",
"ioStack_Name": "Tank Level",
"Send_Interval": 420,
"Protocol": "1",
"MAC_Addr": "4016fa0513b3",
"Tz_Offset_Sec": -28800,
"Bad_Reads": 0,
"Good_Reads": 1,
"Push_Version": "Push3",
"Group": 0,
"Credits": 1000000,
"ReadData": [
{
"Good": 1,
"Good_Reads_Ratio": 100,
"Read_Attempts": 158,
"Date": "2024-01-17",
"Time": "13:52:43.952",
"Time_Stamp_UTC_ms": 1705528363952,
"Device_Time": "2024-01-17T09:57:25",
"Firmware": "1.42",
"Hardware_Type": 133,
"Model": 1,
"Analog_In_1": 1245,
"Analog_In_2": 1213,
"Analog_In_3": 1311,
"Analog_In_4": 1123,
"State_Inputs": 0,
"State_Out": 5,
"Pulse_Cnt_1": 37,
"Pulse_Cnt_2": 0,
"Pulse_Cnt_3": 548706,
"Pulse_Cnt_4": 3026631,
"Pulse_Cnt_Rst_1": 37,
"Pulse_Cnt_Rst_2": 0,
"Pulse_Cnt_Rst_3": 548706,
"Pulse_Cnt_Rst_4": 3026631,
"Pulse_Hold_ms_1": 6056983884,
"Pulse_Hold_ms_2": 6056983884,
"Pulse_Hold_ms_3": 6056983884,
"Pulse_Hold_ms_4": 6056983884,
"Pulse_Hi_Prev_ms_1": 0,
"Pulse_Hi_Prev_ms_2": 0,
"Pulse_Hi_Prev_ms_3": 0,
"Pulse_Hi_Prev_ms_4": 0,
"Pulse_Lo_Prev_ms_1": 0,
"Pulse_Lo_Prev_ms_2": 0,
"Pulse_Lo_Prev_ms_3": 0,
"Pulse_Lo_Prev_ms_4": 0,
"Pulse_Hi_Total_sec_1": 0,
"Pulse_Hi_Total_sec_2": 0,
"Pulse_Hi_Total_sec_3": 0,
"Pulse_Hi_Total_sec_4": 0,
"Pulse_Lo_Total_sec_1": 6056983,
"Pulse_Lo_Total_sec_2": 6056983,
"Pulse_Lo_Total_sec_3": 6056983,
"Pulse_Lo_Total_sec_4": 6056983
}
]
}
]
}
}
Analog_In_1: 1245
{
"readiostack": {
"Requested": 1,
"ReadSet": [
{
"ioStack": "55555",
"ioStack_Name": "Tank Level",
"Send_Interval": 420,
"Protocol": "1",
"MAC_Addr": "4016fa0513b3",
"Tz_Offset_Sec": -28800,
"Bad_Reads": 0,
"Good_Reads": 1,
"Push_Version": "Push3",
"Group": 0,
"Credits": 1000000,
"ReadData": [
{
"Good": 1,
"Good_Reads_Ratio": 100,
"Read_Attempts": 155,
"Date": "2024-01-22",
"Time": "03:36:03.327",
"Time_Stamp_UTC_ms": 1705923363327,
"Device_Time": "2024-01-21T23:38:06",
"Firmware": "1.42",
"Hardware_Type": 133,
"Model": 1,
"Analog_In_1": 1058,
"Analog_In_2": 1032,
"Analog_In_3": 1244,
"Analog_In_4": 1257,
"State_Inputs": 0,
"State_Out": 5,
"Pulse_Cnt_1": 37,
"Pulse_Cnt_2": 0,
"Pulse_Cnt_3": 548706,
"Pulse_Cnt_4": 3026631,
"Pulse_Cnt_Rst_1": 37,
"Pulse_Cnt_Rst_2": 0,
"Pulse_Cnt_Rst_3": 548706,
"Pulse_Cnt_Rst_4": 3026631,
"Pulse_Hold_ms_1": 6451977386,
"Pulse_Hold_ms_2": 6451977386,
"Pulse_Hold_ms_3": 6451977386,
"Pulse_Hold_ms_4": 6451977386,
"Pulse_Hi_Prev_ms_1": 0,
"Pulse_Hi_Prev_ms_2": 0,
"Pulse_Hi_Prev_ms_3": 0,
"Pulse_Hi_Prev_ms_4": 0,
"Pulse_Lo_Prev_ms_1": 0,
"Pulse_Lo_Prev_ms_2": 0,
"Pulse_Lo_Prev_ms_3": 0,
"Pulse_Lo_Prev_ms_4": 0,
"Pulse_Hi_Total_sec_1": 0,
"Pulse_Hi_Total_sec_2": 0,
"Pulse_Hi_Total_sec_3": 0,
"Pulse_Hi_Total_sec_4": 0,
"Pulse_Lo_Total_sec_1": 6451977,
"Pulse_Lo_Total_sec_2": 6451977,
"Pulse_Lo_Total_sec_3": 6451977,
"Pulse_Lo_Total_sec_4": 6451977
}
]
}
]
}
}
Analog_In_1: 1058
All https requests for ioStack will begin with the following information in the HTTPS address:
https://api.ekmpush.com/readiostack?
The information that you provide, such as your EKM Push Key (i.e. MTAxMDoyMDIw) and all other associated information will follow the beginning https address.
Example below of what a typical realtime https address will look like:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
Example of the information that is in a typical https call is as follows:
HTTPS Address | Description |
---|---|
https:// |
Beginning of the https address |
address | Parameter for calling the ioStack data. |
55555 | Exact ioStack device number to call |
key | Parameter for calling the key |
MTAxMDoyMDIw | EKM Push authorization key |
fmt | Parameter expecting the file format to return as |
json | Language format to return the data as (html, xml, json, csv) |
cnt | Parameter for expecting how many meter readings to call |
1 | Exact number of meter readings |
tz | Parameter for selecting your time zone. |
America~Los_Angeles | Time zone selected |
Here is an example URL:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
EKM Device Number and Key
The EKM Push Meter Number is the identification number for the meter currently in service. In the following examples of this API document, we will use the meter number 17507 in all of our HTTPS calls. To use your own meter number, simply replace the example meter number, 17507, with your unique meter number.
For ioStack devices, we will use the ioStack number 55555 in all of our HTTPS calls. To use your own ioStack device number, replace the example ioStack number, 55555, with your unique ioStack device number.
The EKM Push Key is your own Authorization Key that you received for your Push Account. In the following examples of this API document, we will be using the following key MTAxMDoyMDIw in all of our https calls. You will need to change the example key, of MTAxMDoyMDIw, with your own private key in order to access your meters that you have associated with your account.
Get a Specific Device
This endpoint retrieves data for a specific meter/ioStack, including all associated read data.
Get a Specific Meter
In this example we will be using key MTExOjExMQ and meter number 300000369. All other examples in this API will use the key MTAxMDoyMDIw.
Get a Specific Meter
curl -s "https://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&cnt=1"
# Ruby Version: 3.1.2
# Load required modules
require 'net/http'
require 'json'
require 'uri'
# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
uri = URI.parse("https://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&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://api.ekmpush.com/readmeter\
?meters=300000369&key=MTExOjExMQ&fmt=json&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.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://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&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://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&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 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("https://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&cnt=1");
/*
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('https://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&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: v16.14.2
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?meters=300000369&key=MTExOjExMQ&fmt=json&cnt=1');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
If you would like to filter to just 1 meter you can add the filter: meters=METER_ID
In the example below the METER_ID being used is: 300000369
https://api.ekmpush.com/readmeter?meters=
300000369
&key=MTExOjExMQ&fmt=json&cnt=1
The link below is an example of the read data with the associated meter
https://api.ekmpush.com/readmeter?meters=300000369&key=MTExOjExMQ&fmt=json&cnt=1
URL Parameters
Parameter | Description |
---|---|
meters | The ID or number of the meter you want to retrieve |
Get a Specific ioStack
Get a Specific ioStack
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1"
# Ruby Version: 3.1.2
# Load required modules
require 'net/http'
require 'json'
require 'uri'
# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
uri = URI.parse("https://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&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.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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&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 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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1");
/*
You can access any part of the apiObject using code like this:
JSONArray readData = apiObject.getJSONObject("readiostack").getJSONArray("ReadSet").
getJSONObject(0).getJSONArray("ReadData");
System.out.println(readData);*/
// This just outputs the whole apiObject
System.out.println(apiObject.toString(4));
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Get Specific ioStack</title>
<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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
If you would like to filter to just 1 ioStack device you can add the filter: address=IOSTACK_ID
In the example below the IOSTACK_ID being used is: 55555
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1
The link below is an example of the read data with the associated ioStack:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1
URL Parameters
Parameter | Description |
---|---|
address | The ID or number of the ioStack you want to retrieve |
Query Multiple Devices
To view data for multiple devices, you can call them using a tilde (~
) between their identifiers. Next, you can check some examples.
Query Multiple Meters
Query Multiple Meters
curl -s "https://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&cnt=1"
# Ruby Version: 3.1.2
# Load required modules
require 'net/http'
require 'json'
require 'uri'
# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
uri = URI.parse("https://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&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://api.ekmpush.com/readmeter\
?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&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.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://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&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://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&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 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("https://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&cnt=1");
/*
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('https://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&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: v16.14.2
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&cnt=1');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To see multiple meter readings, i.e. meter number 17507 and 15635, your https address should look like the following:
https://api.ekmpush.com/readmeter?meters=
17507~15635
&key=MTAxMDoyMDIw&fmt=json&cnt=1
As you can see in the above example, all that was changed in the https address is the addition of the extra meter to the end of the meters parameter: 17507~15635. This will allow you to call multiple meters to get their individual data readings.
https://api.ekmpush.com/readmeter?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&cnt=1
Query Multiple ioStacks
Query Multiple ioStacks
curl -s "https://api.ekmpush.com/readiostack?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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.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://api.ekmpush.com/readiostack\
?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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://api.ekmpush.com/readiostack' .
'?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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);
return json_decode($json);
}
#!/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://api.ekmpush.com/readiostack?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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 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("https://api.ekmpush.com/readiostack?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&cnt=1");
/*
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 lang="en">
<head>
<title>Query Multiple ioStack Devices</title>
<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://api.ekmpush.com/readiostack?address=55553~55555&key=MTAxMDoyMDIw&fmt=json&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: v16.14.2
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?meters=17507~15635&key=MTAxMDoyMDIw&fmt=json&cnt=1');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To view readings for multiple ioStack devices, for example, IOStack numbers 55553 and 55555, your HTTPS address should be structured as follows:
https://api.ekmpush.com/readiostack?address=
55553~55555
&key=MTAxMDoyMDIw&fmt=json&cnt=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://api.ekmpush.com/readiostack?address=
55553~55555
&key=MTAxMDoyMDIw&fmt=json&cnt=1
Output Formats
Output format: XML
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=xml&cnt=1
The above URL returns XML structured like this:
<readMeter Requested="1">
<ReadSet Meter="17507" Group="0" Send_Interval="60" Protocol="v3" MAC_Addr="40:16:fa:01:02:26" Tz_Offset_Sec="-25200" Bad_Reads="0" Good_Reads="1" Credits="1000000" Push_Version="Push2">
<ReadData Good="1" Date="2022-04-15" Time="10:27:15.141" Time_Stamp_UTC_ms="1650043635141" Firmware="15" Model="1710" kWh_Tot="50986.8" kWh_Tariff_1="5143.0" kWh_Tariff_2="45843.8" Rev_kWh_Tot="0.7" Rev_kWh_Tariff_1="0.4" Rev_kWh_Tariff_2="0.3" RMS_Volts_Ln_1="123.5" RMS_Volts_Ln_2="123.6" Amps_Ln_1="4.0" Amps_Ln_2="4.0" Power_Factor_Ln_1="100" Power_Factor_Ln_2="100" Power_Factor_Ln_3="200" Cos_Theta_Ln_1="1.00" Cos_Theta_Ln_2="1.00" Cos_Theta_Ln_3="0.00 C" RMS_Watts_Ln_1="498" RMS_Watts_Ln_2="498" RMS_Watts_Tot="998" RMS_Watts_Max_Demand="5050" Max_Demand_Period="1" CT_Ratio="200" Meter_Status_Code="00"/>
</ReadSet>
</readMeter>
Output format: JSON
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
The above URL returns JSON structured like this:
{
"readmeter": {
"Requested": 1,
"ReadSet": [
{
"Meter": "17507",
"Group": 0,
"Send_Interval": 60,
"Protocol": "v3",
"MAC_Addr": "40:16:fa:01:02:26",
"Tz_Offset_Sec": -25200,
"Bad_Reads": 0,
"Good_Reads": 1,
"Credits": 1000000,
"Push_Version": "Push2",
"ReadData": [
{
"Good": 1,
"Date": "2022-04-15",
"Time": "10:27:15.141",
"Time_Stamp_UTC_ms": 1650043635141,
"Firmware": "15",
"Model": "1710",
"kWh_Tot": "50986.8",
"kWh_Tariff_1": "5143.0",
"kWh_Tariff_2": "45843.8",
"Rev_kWh_Tot": "0.7",
"Rev_kWh_Tariff_1": "0.4",
"Rev_kWh_Tariff_2": "0.3",
"RMS_Volts_Ln_1": "123.5",
"RMS_Volts_Ln_2": "123.6",
"Amps_Ln_1": "4.0",
"Amps_Ln_2": "4.0",
"Power_Factor_Ln_1": "100",
"Power_Factor_Ln_2": "100",
"Power_Factor_Ln_3": "200",
"Cos_Theta_Ln_1": "1.00",
"Cos_Theta_Ln_2": "1.00",
"Cos_Theta_Ln_3": "0.00 C",
"RMS_Watts_Ln_1": "498",
"RMS_Watts_Ln_2": "498",
"RMS_Watts_Tot": "998",
"RMS_Watts_Max_Demand": "5050",
"Max_Demand_Period": "1",
"CT_Ratio": "200",
"Meter_Status_Code": "00"
}
]
}
]
}
}
Output format: CSV
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=csv&cnt=1
The above URL returns CSV structured like this:
Meter,Good,Date,Time,Time_Stamp_UTC_ms,Meter_Time,Firmware,Model,Good_Reads_Ratio,Read_Attempts,kWh_Tot,kWh_Tariff_1,kWh_Tariff_2,kWh_Tariff_3,kWh_Tariff_4,Rev_kWh_Tot,Rev_kWh_Tariff_1,Rev_kWh_Tariff_2,Rev_kWh_Tariff_3,Rev_kWh_Tariff_4,RMS_Volts_Ln_1,RMS_Volts_Ln_2,RMS_Volts_Ln_3,Amps_Ln_1,Amps_Ln_2,Amps_Ln_3,Power_Factor_Ln_1,Power_Factor_Ln_2,Power_Factor_Ln_3,Cos_Theta_Ln_1,Cos_Theta_Ln_2,Cos_Theta_Ln_3,RMS_Watts_Ln_1,RMS_Watts_Ln_2,RMS_Watts_Ln_3,RMS_Watts_Tot,RMS_Watts_Max_Demand,Max_Demand_Period,CT_Ratio,Meter_Status_Code
17507,1,4/15/2022,10:27:15.141,1650043635141,,15,1710,,,50986.8,5143,45843.8,,,0.7,0.4,0.3,,,123.5,123.6,,4,4,,100,100,200,1,1,0.00 C,498,498,,998,5050,1,200,0
You can call up different output formats to return the meter/ioStack data in. These formats can be: HTML, XML, JSON and CSV.
To access different formats, simply change the FORMAT (indicated as fmt in the HTTPS address) to your desired type. Below, you’ll find URL examples for both meter and ioStack. We will only provide URL examples for Meter requests. If you wish to retrieve various outputs for your ioStack, use the ioStack endpoint and add fmt.
Example URL for Meter
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=
FORMAT
&cnt=1&tz=America~Los_Angeles
Example URL for ioStack
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=
FORMAT
&cnt=1&tz=America~Los_Angeles
The example below will return the meter data in the HTML format ( HyperText Markup Language )
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=html&cnt=1&tz=America~Los_Angeles
Click the link below to see the meter data returned in the XML format ( Extensible Markup Language )
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=xml&cnt=1&tz=America~Los_Angeles
Click the link below to see the meter data returned in the JSON format ( JavaScript Object Notation )
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
+
Click the link below to download the meter data in the CSV format ( Comma Separated Values )
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=csv&cnt=1&tz=America~Los_Angeles
URL Parameters
Parameter | Description |
---|---|
fmt | Available formats are: html, xml, json, and csv |
Number of Reads
In this section, you’ll find a guide on obtaining a specific number of readings for meters or ioStack devices. The guide offers clear instructions and examples to simplify the process of retrieving the needed data from these devices. Whether dealing with meters or ioStack devices, this resource aims to provide straightforward and useful information for obtaining the desired readings.
Number of Reads for Meters
Number of Meter Readings
curl -s "https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000')
# 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 apiRequest 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://api.ekmpush.com/readmeter\
?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000")
# 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000');
// 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000'
);
# 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("https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000");
/*
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('https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000',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: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// 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&fmt=json&cnt=1000');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
The following https format will provide 10 readings of meter data from all Omnimeter Pulse meters in the EKM Push account with key MTAxMDoyMDIw
.
https://api.ekmpush.com/readmeter?key=MTAxMDoyMDIw&fmt=json&cnt=
READ_COUNT
Replace READ_COUNT with the number 10 to call the amount of meter data to read.
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=
10
The link below will show the example of the meter data that is associated with the provided key and the specified number of 10 meter data readings. It will display it as json data.
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10
You can also request anywhere from 1 to 1000 meter reads from any given meter with the following format:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=
READ_COUNT
For 1 meter reading replace READ_COUNT with the number 1 as in the example below:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1
or for 1000 meter readings replace READ_COUNT with the number 1000 as in the example below:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1000
URL Parameters
Parameters | Description |
---|---|
cnt | Number of meter reads to display |
Number of Reads for ioStack
Number of ioStack Readings
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000')
# 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 apiRequest 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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000")
# 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000');
// 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000'
);
# 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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000");
/*
You can access any part of the apiObject using code like this:
JSONArray readData = apiObject.getJSONObject("readiostack").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(
"https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000",
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: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
The following HTTPS format retrieves 10 readings for every ioStack device connected to the EKM Push account with the key MTAxMDoyMDIw
.
Use the following URL to access the specified amount of ioStack data:
https://api.ekmpush.com/readiostack?key=MTAxMDoyMDIw&fmt=json&cnt=
READ_COUNT
Replace READ_COUNT with the number 10 to specify the desired amount of data to be retrieved for a specific ioStack device:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=
10
The link below displays JSON data for the ioStack device with the address 55555, linked to the provided key, and showing 10 specified ioStack data readings:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10
You can request ioStack device reads ranging from 1 to 1000 from any specific ioStack using the following format:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=
READ_COUNT
For 1 meter reading replace READ_COUNT with the number 1 as in the example below:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1
or for 1000 meter readings replace READ_COUNT with the number 1000 as in the example below:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000
URL Parameters
Parameters | Description |
---|---|
cnt | Number of ioStack device reads to display. |
Time Zones
By default the Push system returns the time as UTC Time (computer time) in milliseconds.
Click the link below to go to the Wikipedia database for time zones and related information.
Click for Time Zone Information
Time Zones for Meter
Time Zones for Meter
curl -s "https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles')
# 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://api.ekmpush.com/readmeter\
?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles")
# 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles');
// 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles'
);
# 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("https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles");
/*
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('https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles',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: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// 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&fmt=json&cnt=1&tz=America~Los_Angeles');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
If you would like the time returned in a specific time zone for your meter, you can add this to the URL call:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=
TIME_ZONE
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 JSON data for the given parameters in the HTTPS address.
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
URL Parameters
Parameter | Description |
---|---|
tz | The time zone is the country and city where the meter is in service. Example: America~Los_Angeles |
Time Zones for ioStack
Time Zones for ioStack
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles')
# 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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles")
# 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles');
// 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles'
);
# 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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles");
/*
You can access any part of the apiObject using code like this:
JSONArray readData = apiObject.getJSONObject("readiostack").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(
"https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles",
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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?address=55555&key=MTAxMDoyMDIw&fmt=json&' +
'cnt=1&tz=America~Los_Angeles');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
If you want the time to be returned in a specific time zone for your ioStack, you can include this in the URL call:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=
TIME_ZONE
In the following example, the requested TIME ZONE is set to the country of America, specifically the city of Los Angeles. The time zone for this location will be the PACIFIC TIME ZONE with a UTC offset of -8:00.
The following example link will provide JSON data based on the specified parameters in the HTTPS address:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles
URL Parameters
Parameter | Description |
---|---|
tz | The time zone is the country and city where the meter is in service. Example: America~Los_Angeles |
Timestamp Call
You can call all available data from a given timestamp.
With this you can call up to 1000 meter/ioStack readings from the last time you retrieved data. So you might get just 1 reading back or 1000 readings depending on how many meter/ioStack readings have been inserted since your last call (timestamp).
Meter Timestamp Call
Meter Timestamp Data Call
curl -s "https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=10&tz=America~Los_Angeles&since=1415218436919')
# 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 apiObject from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://api.ekmpush.com/readmeter\
?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919")
# 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919');
// 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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919'
);
# 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("https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919");
/*
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('https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919',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: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// 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&fmt=json&' +
'cnt=10&tz=America~Los_Angeles&since=1415218436919');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To retrieve data for your meter using a timestamp, you need to make the request as follows:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&until=
UNTIL
You can also use the filter “since”: since=Time
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=
SINCE
The Time can either be the current time or a previous period in time that you want to obtain a specific meter data reading. The time will be formatted in milliseconds.
Example below is how the HTTPS address will look like using the until time parameter. To see an example of the since parameter just replace until with since in the https address, the time being used is - 1415218436919. Remember, the time is formatted in milliseconds.
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919
URL Parameters
Parameter | Description |
---|---|
since or until | Since the last call or Until a certain call. The timestamp is in UTC Time ( computer time ), formatted in milliseconds. |
ioStack Timestamp Call
ioStack Timestamp Data Call
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=10&tz=America~Los_Angeles&since=1705964100000')
# 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 apiObject from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000")
# 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000');
// 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000'
);
# 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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000");
/*
You can access any part of the apiObject using code like this:
JSONArray readData = apiObject.getJSONObject("readiostack").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(
"https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000",
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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get('?address=55555&key=MTAxMDoyMDIw&fmt=json' +
'&cnt=10&tz=America~Los_Angeles&since=1705964100000');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To fetch data for your ioStack based on a timestamp, you should initiate the request in the following manner:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&until=
UNTIL
You can also use the filter “since”: since=Time
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=
SINCE
The Time can represent either the current moment or a past time period for which you seek a specific meter data reading. Time will be formatted in milliseconds.
The example below illustrates the structure of the HTTPS address using the until time parameter. To view an example with the since parameter, simply substitute until with since in the HTTPS address. The time being utilized in this example is - 1705964100000. It’s important to note that the time is formatted in milliseconds.
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1705964100000
URL Parameters
Parameter | Description |
---|---|
since or until | Since the last call or Until a specific call, the timestamp is in UTC time (computer time), formatted in milliseconds. |
Date and Time
You can use start_date and end_date to report on a range of data for the last 24 hours or 1000 reads, whichever is greater. For instance, if you have 1-minute read intervals, you can go back 24 hours or up to 1440 reads. If you have 1-hour read intervals, you can go back 1000 hours. To specify a particular time period within the start_date and end_date range, you can also include the start_time and end_time parameters.
NOTES:
- Please be aware that you are requesting this data from the Realtime API endpoint. If you need to access historical data, you can refer to the Summary API endpoint.
- The following examples are written for a specific date. When you read this, that date will not be applicable. Please use an actual date for your test or code.
Meter Start Date & End Date
Meter Start Date & End Date
curl -s "https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023')
# 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://api.ekmpush.com/readmeter\
?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&start_date=06112023&end_date=07112023")
# 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://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023');
// 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://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023'
);
# 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("https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023");
/*
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('https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023',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: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?meters=300001290&key=MTAxMDoyMDIw&fmt=json&' +
'cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
You can also call the available meter read data for a given meter by a specified date with the following parameters in the HTTPS address.
https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=
DDMMYYYY
&end_date=
DDMMYYYY
Date Parameter
Parameter | Description |
---|---|
dd | Indicates the day of the month. Example: 06, for the sixth day of the month. |
mm | Indicates the month to be called. Example: 11, for the month of November. |
yyyy | Indicates the year to be called. Example: 2023, for the year 2023. |
Let’s say you would like to pull the meter reading data for November 06, 2023 to November 07, 2023. Your https address would look like the following:
https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=06112023&end_date=07112023
URL Parameters
Parameter | Description |
---|---|
start_date | Date for the meter reading to begin. Example of ddmmyyyy is as follows: 06112023 = November 6, 2023 |
end_date | Data for the meter reading to end. Example of ddmmyyyy is as follows: 07112023 = November 7, 2023 |
Meter Start Time & End Time
Meter Start Time & End Time
curl -s "https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500')
# 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://api.ekmpush.com/readmeter\
?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&start_time=062400&end_time=062500")
# 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://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500');
// 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 Modules3
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://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500'
);
# 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("https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500");
/*
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('https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500',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: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get('?meters=300001290&key=MTAxMDoyMDIw&' +
'fmt=json&cnt=10&tz=America~Los_Angeles&start_time=062400&end_time=062500');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
You can also call the available meter read data for a given meter by a specified time when using start_date and end_date with the following https parameters
This format is similar to the start and end date https request.
https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=30042021&
start_time
=
HHMMSS
&
end_time
=
HHMMSS
Time Parameters
Parameter | Description |
---|---|
hh | Indicates the hours of the day. Example: 0600, for 6:00 A.M. or 13:00, for 1:00 P.M. |
mm | Indicates the minutes of the hour. Example: 0624, for 24 minutes into the hour of 6:00 A.M. or 6:24 A.M. |
ss | Indicates the seconds of the minute. Example: 062430, for 30 seconds into the minute of 24, or 6:24.30 A.M. |
If you want to pull the meter reading data for a specific period of the day, let’s say for 062400 A.M. to 062500 A.M., then your https address would look like the following:
https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=062400&end_time=062500
You can also call data from any number of seconds ago. The example below will call all available data from 300 seconds ago.
Instead of adding the start_time and end_time parameter use the back=seconds parameter.
https://api.ekmpush.com/readmeter?meters=300001290&key=MTAxMDoyMDIw&fmt=json&cnt=1000&tz=America~Los_Angeles&back=300
URL Parameters
Parameter | Description |
---|---|
start_time | Time to begin the data call. Format in which the time is written in: hhmmss - hours, minutes, seconds. Example: 062400 = 6:24.00 A.M. |
end_time | Time to end the data call. Format in which the time is written in: hhmmss- hours, minutes, seconds. Example: 062500 = 6:25.00 A.M. |
back | Time in seconds, up to 300 seconds |
ioStack Start Date & End Date
ioStack Start Date & End Date
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json'\ '&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024')
# 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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&start_date=21012024&end_date=22012024")
# 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024');
// 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://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024'
);
# 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("https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024");
/*
You can access any part of the apiObject using code like this:
JSONArray readData = apiObject.getJSONObject("readiostack").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(
"https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024",
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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get(
'?address=55555&key=MTAxMDoyMDIw&fmt=json&' +
'cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
You can retrieve available ioStack read data for a specific ioStack based on a specified date using the following parameters in the HTTPS address.
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=
DDMMYYYY
&end_date=
DDMMYYYY
Date Parameter
Parameter | Description |
---|---|
dd | Indicates the day of the month. Example: 21, for the twenty-first day of the month. |
mm | Indicates the month to be called. Example: 01, for the month of January. |
yyyy | Indicates the year to be called. Example: 2024, for the year 2024. |
Suppose you want to retrieve ioStack reading data from January 21, 2024, to January 22, 2024. Your HTTPS address would appear as follows:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=21012024&end_date=22012024
URL Parameters
Parameter | Description |
---|---|
start_date | Date for the ioStack reading to begin. Example of ddmmyyyy is as follows: 21012024 = January 21, 2024 |
end_date | Data for the meter reading to end. Example of ddmmyyyy is as follows: 22012024 = January 22, 2024 |
ioStack Start Time & End Time
ioStack Start Time & End Time
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=092400&end_time=092500"
# 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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=1&tz=America~Los_Angeles&start_time=092400&end_time=092500')
# 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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&start_time=092400&end_time=092500")
# 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
$apiUrl = 'https://api.ekmpush.com/readiostack';
$apiUrl .= '?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles';
$apiUrl .= '&start_time=092400&end_time=092500';
$apiObject = callApi($apiUrl);
// 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 Modules3
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_url = 'https://api.ekmpush.com/readiostack';
$api_url .= '?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles';
$api_url .= '&start_time=092400&end_time=092500';
my $api_object = call_api($api_url);
# 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
*/
String apiUrl = "https://api.ekmpush.com/readiostack";
apiUrl += "?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles";
apiUrl += "&start_time=092400&end_time=092500";
JSONObject apiObject = EKM.callApi(apiUrl);
/*
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(
"https://api.ekmpush.com/readiostack" +
"?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles" +
"&start_time=092400&end_time=092500",
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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get('?address=55555&key=MTAxMDoyMDIw' +
'&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=092400&end_time=092500');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
You can retrieve ioStack read data for a specific time by using the start_date and end_date parameters in the web address. This format is similar to making an https request for a start and end date:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_date=22012024&
start_time
=
HHMMSS
&
end_time
=
HHMMSS
Time Parameters
Parameter | Description |
---|---|
hh | Indicates the hours of the day. Example: 0900, for 9:00 A.M. or 13:00, for 1:00 P.M. |
mm | Indicates the minutes of the hour. Example: 0924, for 24 minutes into the hour of 9:00 A.M. or 9:24 A.M. |
ss | Indicates the seconds of the minute. Example: 092430, for 30 seconds into the minute of 24, or 9:24.30 A.M. |
If you wish to retrieve ioStack reading data for a specific time of the day, such as from 09:24:00 AM to 09:25:00 AM, your https address would appear as follows:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&start_time=092400&end_time=092500
You can retrieve data from any number of seconds ago by using the back=seconds parameter. The example below demonstrates calling all available data from 300 seconds ago, without the need for the start_time and end_time parameters.
Instead of adding the start_time and end_time parameter use the back=seconds parameter.
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1000&tz=America~Los_Angeles&back=300
URL Parameters
Parameter | Description |
---|---|
start_time | Time to begin the data call. Format in which the time is written in: hhmmss - hours, minutes, seconds. Example: 092400 = 9:24.00 A.M. |
end_time | Time to end the data call. Format in which the time is written in: hhmmss- hours, minutes, seconds. Example: 092500 = 9:25.00 A.M. |
back | Time in seconds, up to 300 seconds |
Fields
You can filter for just the data fields you are interested in by using fields=FIELDS, after the time zone call parameter.
Meter Fields
Meter Fields
curl -s "https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot"
# Ruby Version: 3.1.2
# Load required modules
require 'net/http'
require 'json'
require 'uri'
# Call the call_api method to create a usable
# object named api_object from the API request URI
# Put the API request URI in the call
def call_api(api_path)
uri = URI.parse("https://api.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://api.ekmpush.com
api_object = call_api('/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot')
# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp api_object
'''
Python version: 3.9.12
'''
# Required Python Modules
import urllib.request
import urllib.error
import urllib.parse
import json
import pprint
# This function accesses the api_request URL and converts
# the contents to a usable Python object and returns it
def call_api ( api_request ):
'''Make http request'''
response = urllib.request.urlopen(api_request)
response = response.read()
json_object = json.loads(response.decode())
return json_object
# Call the call_api function to create a usable
# object named api_object from the API request URL.
# Put the API request URL in the call
api_object = call_api("https://api.ekmpush.com/readmeter\
?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot")
# This just displays the object but you can use what ever
# code you would like to work with the object here
pprint.pprint(api_object)
<?php
// PHP 8.0.17 (cli)
// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot');
// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);
// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
function callApi ($apiRequest='') {
$json=@file_get_contents($apiRequest);
$jsonObject=json_decode($json);
return ($jsonObject);
}
?>
#!/usr/bin/perl
# Perl version: v5.34
# CPAN.pm version 2.2
# Perl Modules Version:
# JSON: 4.05
# LWP::Protocol::https: 6.10
# LWP::Simple: 6.62
#
# OS Prerequisites
# UBUNTU
# apt install cpanminus
#
# Install Perl Modules
# cpan LWP::Simple
# cpan LWP::Protocol::https
# cpan JSON
# Required Perl Modules3
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://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot'
);
# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($api_object); ## no critic (InputOutput::RequireCheckedSyscalls)
/*
openjdk version "17.0.2" 2022-01-18
Download the correct org.json jar version for your
needs from: https://mvnrepository.com/artifact/org.json/json
This example uses version 20220320 accessible here:
https://repo1.maven.org/maven2/org/json/json/20220320/json-20220320.jar
Instructions to run this program
1. Put this code in a file named EKM.java
2. Copy the downloaded org.json jar and EKM.java to the same directory
3. Compile
javac -cp .:./json-20220320.jar ./EKM.java
4. Run
java -cp .:./json-20220320.jar EKM
*/
//Import required classes
import java.net.*;
import java.io.*;
import org.json.*;
@java.lang.SuppressWarnings({"java:S106", "java:S112", "java:S125"})
public class EKM {
public static 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("https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot");
/*
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('https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot',function(apiObject){
// This just displays the object in the result div
// you can use what ever code you would like to work
// with the object here
document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
});
};
// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
var jsonObject = JSON.parse(xhttp.responseText);
callback(jsonObject);
}
};
xhttp.open("GET", apiRequest, true);
xhttp.send();
}
</script>
</head>
<body onload="example()">
<div id="result"/>
</body>
</html>
/*
* Requirements
* NodeJS: v16.14.2
* Axios: 0.27.2
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readmeter',
timeout: 1000 * 15,
})
// 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&' +
'fmt=json&cnt=1&tz=America~Los_Angeles&' +
'fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To filter your meter data using a specific field, you need to make an HTTPS request with the following format:
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=
FIELDS
In the example below we are only interested in finding out the Total Kilowatt Hours, Reverse kWh, and Total Watts. To retrieve the data associated with the different fields use the abbreviated name of the field you are interested in after the fields parameter, followed by a tilde separator if calling for more than one field.
https://api.ekmpush.com/readmeter?meters=17507&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot
The data fields that you are interested in is not limited to these three in the example above. You can add just one field or include as many as your needs require.
URL Parameters
The fields below are for the v3, v4 and v5 meters
Fields | 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 line 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 |
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_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 Watts (all lines) |
RMS_Watts_ |
Max Demand |
Max_Demand_Period | Max Demand Period 15 min = 1 30 min = 2 Hour = 3 |
CT_Ratio | Current Transformer Ratio |
The fields below are additional fields only for the v4 and v5 meters
Fields | Description |
---|---|
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 |
State_In | State of Inputs Line1/Line2/Line3 Low/Low/Low = 0 Low/Low/High = 1 Low/High/Low = 2 Low/High/High = 3 High/Low/Low = 4 High/Low/High = 5 High/High/Low = 6 High/High/High = 7 |
Reactive_Energy_Tot | Total Kilo Volt Amperes Reactive Hours |
kWh_Rst | Resettable Kilowatt Hour |
Rev_kWh_Rst | Resettable Reverse Kilowatt Hour |
kWh_Scale | Decimal places for Kilowatt Hour 0 Decimal Places = 0 1 Decimal Place = 1 2 Decimal Places = 2 |
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) |
State_Watts_Dir | Real-time Direction of Current Line1/Line2/Line3 Forward/Forward/Forward = 1 Forward/Forward/Reverse = 2 Forward/Reverse/Forward = 3 Reverse/Forward/Forward = 4 Forward/Reverse/Reverse = 5 Reverse/Forward/Reverse = 6 Reverse/Reverse/Forward = 7 Reverse/Reverse/Reverse = 8 |
State_Out | State of Outputs OFF/OFF = 1 OFF/ON = 2 ON/OFF = 3 ON/ON = 4 |
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
ioStack Fields
curl -s "https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=Analog_In_1~Analog_In_2~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://api.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://api.ekmpush.com
api_object = call_api('/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json'\
'&cnt=1&tz=America~Los_Angeles&fields=Analog_In_1~Analog_In_2~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://api.ekmpush.com/readiostack\
?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles\
&fields=Analog_In_1~Analog_In_2~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
$apiUrl = 'https://api.ekmpush.com/readiostack';
$apiUrl .= '?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles';
$apiUrl .= '&fields=Analog_In_1~Analog_In_2~Pulse_Cnt_1';
$apiObject = callApi($apiUrl);
// 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 Modules3
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_url = 'https://api.ekmpush.com/readiostack';
$api_url .= '?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles';
$api_url .= '&fields=Analog_In_1~Analog_In_2~Pulse_Cnt_1';
my $api_object = call_api($api_url);
# 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
*/
String apiUrl = "https://api.ekmpush.com/readiostack";
apiUrl += "?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles";
apiUrl += "&fields=Analog_In_1~Analog_In_2~Pulse_Cnt_1";
JSONObject apiObject = EKM.callApi(apiUrl);
/*
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(
"https://api.ekmpush.com/readiostack" +
"?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles" +
"&fields=Analog_In_1~Analog_In_2~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
*/
// Load modules
const axios = require('axios');
const apiClient = axios.create({
baseURL: 'https://api.ekmpush.com/readiostack',
timeout: 1000 * 15,
})
// This code accesses the apiRequest query and
// logs the response data or the error
;(async () => {
try {
const res = await apiClient.get('?address=55555&key=MTAxMDoyMDIw&' +
'fmt=json&cnt=1&tz=America~Los_Angeles' +
'&fields=Analog_In_1~Analog_In_2~Pulse_Cnt_1');
const apiResData = res.data;
console.log(JSON.stringify(apiResData, null, 2));
} catch (error) {
console.error(error.message);
}
})();
To filter your ioStack data based on a specific field, simply make an HTTPS request using the following format:
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=
FIELDS
In the example below, we only want information about Analog_In_1, Analog_In_2, and Pulse_Cnt_1. To get data for specific fields, use the short name of each field you want after the fields parameter. If you’re requesting more than one field, separate them with a tilde (~).
https://api.ekmpush.com/readiostack?address=55555&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles&fields=Analog_In_1~Analog_In_2~Pulse_Cnt_1
The data fields you want aren’t restricted to the three mentioned in the example. You can include just one field or as many as you need.
URL Parameters
The fields below are for ioStack
Fields | Description |
---|---|
Analog_In_1 | Analog Input 1 |
Analog_In_2 | Analog Input 2 |
Analog_In_3 | Analog Input 3 |
Analog_In_4 | Analog Input 4 |
State_Inputs | Pulse Input State |
State_Out | Control Output State |
Pulse_Cnt_1 | Pulse Count 1 |
Pulse_Cnt_2 | Pulse Count 2 |
Pulse_Cnt_3 | Pulse Count 3 |
Pulse_Cnt_4 | Pulse Count 4 |
Pulse_Cnt_Rst_1 | Resettable Pulse Count 1 |
Pulse_Cnt_Rst_2 | Resettable Pulse Count 2 |
Pulse_Cnt_Rst_3 | Resettable Pulse Count 3 |
Pulse_Cnt_Rst_4 | Resettable Pulse Count 4 |
Pulse_Hold_ms_1 | Pulse Hold (ms) 1 |
Pulse_Hold_ms_2 | Pulse Hold (ms) 2 |
Pulse_Hold_ms_3 | Pulse Hold (ms) 3 |
Pulse_Hold_ms_4 | Pulse Hold (ms) 4 |
Pulse_Hi_Prev_ms_1 | Pulse High Previous (ms) 1 |
Pulse_Hi_Prev_ms_2 | Pulse High Previous (ms) 2 |
Pulse_Hi_Prev_ms_3 | Pulse High Previous (ms) 3 |
Pulse_Hi_Prev_ms_4 | Pulse High Previous (ms) 4 |
Pulse_Lo_Prev_ms_1 | Pulse Low Previous (ms) 1 |
Pulse_Lo_Prev_ms_2 | Pulse Low Previous (ms) 2 |
Pulse_Lo_Prev_ms_3 | Pulse Low Previous (ms) 3 |
Pulse_Lo_Prev_ms_4 | Pulse Low Previous (ms) 4 |
Pulse_Hi_Total_sec_1 | Pulse High Total (sec) 1 |
Pulse_Hi_Total_sec_2 | Pulse High Total (sec) 2 |
Pulse_Hi_Total_sec_3 | Pulse High Total (sec) 3 |
Pulse_Hi_Total_sec_4 | Pulse High Total (sec) 4 |
Pulse_Lo_Total_sec_1 | Pulse Low Total (sec) 1 |
Pulse_Lo_Total_sec_2 | Pulse Low Total (sec) 2 |
Pulse_Lo_Total_sec_3 | Pulse Low Total (sec) 3 |
Pulse_Lo_Total_sec_4 | Pulse Low Total (sec) 4 |
OW_1_1_degC | 1-Wire 1_1 Degree C |
OW_1_2_degC | 1-Wire 1_2 Degree C |
OW_1_3_degC | 1-Wire 1_3 Degree C |
OW_1_4_degC | 1-Wire 1_4 Degree C |
OW_2_1_degC | 1-Wire 2_1 Degree C |
OW_2_2_degC | 1-Wire 2_2 Degree C |
OW_2_3_degC | 1-Wire 2_3 Degree C |
OW_2_4_degC | 1-Wire 2_4 Degree C |
OW_3_1_degC | 1-Wire 3_1 Degree C |
OW_3_2_degC | 1-Wire 3_2 Degree C |
OW_3_3_degC | 1-Wire 3_3 Degree C |
OW_3_4_degC | 1-Wire 3_4 Degree C |
OW_4_1_degC | 1-Wire 4_1 Degree C |
OW_4_2_degC | 1-Wire 4_2 Degree C |
OW_4_3_degC | 1-Wire 4_3 Degree C |
OW_4_4_degC | 1-Wire 4_4 Degree C |
OW_1_1_Humidity | 1-Wire 1_1 Humidity |
OW_1_2_Humidity | 1-Wire 1_2 Humidity |
OW_1_3_Humidity | 1-Wire 1_3 Humidity |
OW_1_4_Humidity | 1-Wire 1_4 Humidity |
OW_2_1_Humidity | 1-Wire 2_1 Humidity |
OW_2_2_Humidity | 1-Wire 2_2 Humidity |
OW_2_3_Humidity | 1-Wire 2_3 Humidity |
OW_2_4_Humidity | 1-Wire 2_4 Humidity |
OW_3_1_Humidity | 1-Wire 3_1 Humidity |
OW_3_2_Humidity | 1-Wire 3_2 Humidity |
OW_3_3_Humidity | 1-Wire 3_3 Humidity |
OW_3_4_Humidity | 1-Wire 3_4 Humidity |
OW_4_1_Humidity | 1-Wire 4_1 Humidity |
OW_4_2_Humidity | 1-Wire 4_2 Humidity |
OW_4_3_Humidity | 1-Wire 4_3 Humidity |
OW_4_4_Humidity | 1-Wire 4_4 Humidity |
OW_1_1_Lux | 1-Wire 1_1 Lux |
OW_1_2_Lux | 1-Wire 1_2 Lux |
OW_1_3_Lux | 1-Wire 1_3 Lux |
OW_1_4_Lux | 1-Wire 1_4 Lux |
OW_2_1_Lux | 1-Wire 2_1 Lux |
OW_2_2_Lux | 1-Wire 2_2 Lux |
OW_2_3_Lux | 1-Wire 2_3 Lux |
OW_2_4_Lux | 1-Wire 2_4 Lux |
OW_3_1_Lux | 1-Wire 3_1 Lux |
OW_3_2_Lux | 1-Wire 3_2 Lux |
OW_3_3_Lux | 1-Wire 3_3 Lux |
OW_3_4_Lux | 1-Wire 3_4 Lux |
OW_4_1_Lux | 1-Wire 4_1 Lux |
OW_4_2_Lux | 1-Wire 4_2 Lux |
OW_4_3_Lux | 1-Wire 4_3 Lux |
OW_4_4_Lux | 1-Wire 4_4 Lux |
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
Click here to go to Summary V2 Documentation
Summary V2 API is a new set of summary features, such as First/Last to get the first and/or last reported date for the given meter(s)/ioStack(s), GStat for getting the status of one or more gateways, IOStack for getting information from new sensors, and more.
The API V2 summary and documentation are currently in beta, signifying that they are subject to changes and updates. It’s important to note that the API V2 calls and specifications provided in this documentation may undergo modifications as the beta phase progresses. Users should stay informed and regularly check for updates to ensure compatibility and adherence to the latest specifications
MQTT Messaging
Click here to go to MQTT Documentation
MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for low-bandwidth, high-latency, or unreliable networks, often used in Internet of Things (IoT) applications. It follows a publish-subscribe model, where devices (clients) can publish messages to topics or subscribe to topics to receive messages.
MQTT will only work with Push3 Gateways. It is more efficient than making hundreds of API calls, 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.