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 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, Java, Javascript, Nodejs and C! 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 http 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"

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('URI Here')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("URL Here")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('URL Here',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

Make sure to replace the sample key: MTAxMDoyMDIw, with your API key in the http 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 individually, and keys can be created to provide access to sub groups of meters upon request. These secondary keys can be used to share single meters, or a subset of meters, without sharing access to all meters in an account. For example, if you are a landlord with multiple rentals and meters, you could share specific meter 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

You must replace: MTAxMDoyMDIw, with your personal EKM Push User Key.

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 1000 latest meter reads for each of your meters. If your meter is being read once per minute, the data will be made available once per minute, per meter. Whether you have 1 meter or 10,000 meters, 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.

Realtime HTTP Request

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068&ver=v3&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 hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

Realtime Secure HTTPS

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("https://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10');// 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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("https://io.ekmpush.com/readMeter?meters=300000369&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("https://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10");/*
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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('https://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10',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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('https://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("https://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

You can generate EKM API calls using the secure form of http.
To do this all that is needed is to change the http to https in the address.

URL Parameters

Parameter

Description

HTTP

Non Secure

HTTPS

Secure

Realtime Meter Number and Key

The EKM Push Meter Number is the number of your meter that you have in service. In the following examples of this API document, we will be using the meter number 10068 in all of our http calls. Meter 10068 is a version 3 Meter so you will also set the “ver” parameter to v3. To use your own meter number simply replace the example meter number, of 10068, with your own meter number, and replace v3 with the version of your meter (v3 or v4)

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 http 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.

Realtime Get a Specific Meter

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

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10');// 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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10");/*
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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10',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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

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

Realtime Query Multiple Meters

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10');// 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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10");/*
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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10',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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

To see multiple meter readings, i.e. meter number 10068 and 10054 from v3 meters, your html address should look like the following:

As you can see in the above example, all that is changed to the http address is the addition of the extra meter to the end of the meters parameter: 10068~10054.
This will allow you to call multiple meters to get their individual data readings.

Realtime Number of Meter Reads

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068&ver=v3&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 hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1000',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

The following http format will provide 10 readings of meter data from all Omnimeter Pulse v.3 meters in the EKM Push account with key MTAxMDoyMDIw.

Realtime Time Zones

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the call# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

By default the Push system returns the time as UTC Time (computer time) in milliseconds.

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

Realtime Timestamp Call

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068&ver=v3&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 hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

You can call all available data from a given timestamp.

With this you can call up to 1000 meter readings from the last time you retrieved data. So you might get just 1 reading back or 1000 readings depending on how many meter readings have been inserted since your last call ( timestamp ).

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 http address will look like using the until time parameter. To see an example of the since parameter just replace until with since in the http address, the time being used is - 1415218436919. Remember, the time is formatted in milliseconds.

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.

Realtime Date and Time

You can use start_date and end_date to report on a range of data for entire days or you can also add the start_time and end_time parameters to select what time period in the start_date and end_date range to report on

Realtime Start Date & End Date

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015');// 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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015");/*
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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015',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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

You can also call the available meter read data for a given meter by a specified date with the following parameters in the http address.

Realtime Start Time & End Time

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&start_time=062400&end_time=062500',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

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 http parameters

Realtime Fields

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('io.ekmpush.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&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 hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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 heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&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
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

You can filter for just the data fields you are interested in by using fields=FIELDS, after the time zone call parameter.

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.

Summary API

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.

Summary HTTP Request

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

HTTP Address

Description

http://summary.ekmmetering.com/summary?

Beginning of the http address

meters

Parameter for calling the meter

10068

Exact meter to call

key

Parameter for calling the key

MTAxMDoyMDIw

EKM Push authorization key that is assigned to the meter

format

Parameter for calling the file format to return as

html

Language format to return the data as (html, xml, json, csv)

report

Parameter for calling a specific time period

15

This will show 15 minute summary result increments. This is also the default time period number that the Summary API uses to return the results in if the report parameter is not specified

limit

Parameter that sets the number of rows to show in the report

1

This will only show one row in the summary report. The default number is ten ( 10 ) that will show in the report if the limit parameter is not specified

field

Parameter for calling specific fields in the report

kWh_Tot*

Type of field to display in the summary results. An asterisk ( * ) will be included at the end of each field type if you are wanting to include all values in that field. Example: Calling the kWh_Tot* parameter will include the DeltaMin, DeltaMax, Min, Max and Diff values for the associated field.

Summary Secure HTTPS

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTPS.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include https://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// Call the callApi function to create a usable
// object named $apiObject from the API request URL.
// Put the API request URL in the call
$apiObject=callApi('https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("https://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

You can generate EKM API calls using the secure form of http.
To do this all that is needed is to change the http to https in the address.

URL Parameters

Parameter

Description

HTTP

Non Secure

HTTPS

Secure

Summary Meter Number and Key

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

The EKM Summary Key is the same Authorization Key that you received for your Realtime EKM Push Account. In the following examples of this Summary API document, we will be using the following key MTAxMDoyMDIw in all of our http 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.

Summary Get a Specific Meter

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

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=json&report=15&limit=5&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

Summary Query Multiple Meters

Aggregate

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

RequiredPythonModulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)t15owsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)t15owsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);t15owerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=json&report=15&limit=5&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

To see multiple meters in your summary report, for example: meters 10068 and 10054, your http address should look like the following:

Bulk

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

RequiredPythonModulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)t15owsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)t15owsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);t15owerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1");// This just displays the object but you can use what ever
// code you would like to work with the object here
json_object*readmeter_json;json_object_object_get_ex(apiObject,"readMeter",&readmeter_json);printf("Complete readMeter Object: \n%s",json_object_to_json_string_ext(readmeter_json,JSON_C_TO_STRING_PRETTY));// This example digs deaper into the JSON and displays the first
// kwh_tot value for the first read of the first meter
json_object*readset_json;json_object*readset_0_json;json_object*readdata_json;json_object*readdata_0_json;json_object*kwh_tot;json_object_object_get_ex(readmeter_json,"ReadSet",&readset_json);readset_0_json=json_object_array_get_idx(readset_json,0);json_object_object_get_ex(readset_0_json,"ReadData",&readdata_json);readdata_0_json=json_object_array_get_idx(readdata_json,0);json_object_object_get_ex(readdata_0_json,"kWh_Tot",&kwh_tot);printf("\nkWh_Tot: %s",json_object_to_json_string_ext(kwh_tot,JSON_C_TO_STRING_PRETTY));return0;}

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

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

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

URL Parameter

Parameter

Description

bulk

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

Please note that by default the summary report does not display the results of each individual meter, instead it aggregates the results for all the meters in the group to provide a combined summary of the meters queried.
Make sure to use a tilde separator ( ~ ) or a comma ( , ) in between the meter numbers when requesting multiple meter summary reports.

Summary Reports

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&fields=kWh_Tot");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

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

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

Summary Number of Summaries

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

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

Remember that the default number of reports that are generated will be ten ( 10 ). If you need more or less of the summary rows in the results, include the limit parameter in the http address with the number of rows you require.

URL Parameters

Parameters

Description

limit

Number of rows to display in the summary results page

Summary Offset & Timelimit

Offset

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

Timelimit

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONObjectcallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONObjectjsonObject=newJSONObject(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONObjectapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_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 apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://io.ekmpush.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the call# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=hr&limit=25&offset=0&timezone=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

Summary Hours

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&hours=1300-1530&fields=kWh_Tot*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

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

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

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

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

Summary Fields

# Load required modulesrequire'net/http'require'json'# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the calldefcallApi(apiRequest)json=Net::HTTP.get('summary.ekmmetering.com',apiRequest)returnJSON.parse(json)end# Call the callApi method to create a usable# object named apiObject from the API request URI# Put the API request URI in the call# URI only NOT URL - Do not include http://summary.ekmmetering.comapiObject=callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')# This just displays the object but you can use what ever# code you would like to work with the object hererequire'pp'ppapiObject

# Required Python Modulesimporturllib2importjson# This function accesses the apiRequest URL and converts# the contents to a usable Python object and returns itdefcallApi(apiRequest):response=urllib2.urlopen(apiRequest)response=response.read()jsonObject=json.loads(response)returnjsonObject# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callapiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*")# This just displays the object but you can use what ever# code you would like to work with the object hereimportpprintpprint.pprint(apiObject)

<?php// 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('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');// This just displays the object but you can use what ever
// code you would like to work with the object here
var_dump($apiObject);// This function accesses the apiRequest URL and converts
// the contents to a usable PHP object and returns it
functioncallApi($apiRequest=''){$json=@file_get_contents($apiRequest);$jsonObject=json_decode($json);return($jsonObject);}?>

# Install JSON module# for example on centos 6.5# yum install cpan# cpan JSON# Required Perl ModulesuseLWP::Simple;useJSON;useData::Dumper;# This function accesses the apiRequest URL and converts# the contents to a usable Perl object and returns itsub callApi{my$apiRequest=shift;my$json_text=get(q[$apiRequest]);my$jsonObject=JSON->new->utf8->decode($json_text);return$jsonObject;}# Call the callApi function to create a usable# object named apiObject from the API request URL.# Put the API request URL in the callmy$apiObject=callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");# This just displays the object but you can use what ever# code you would like to work with the object hereprintDumper($apiObject);

/*
Download the correct org.json jar version for your
needs from: http://mvnrepository.com/artifact/org.json/json
This example uses version 20131018 accessible here:
http://mvnrepository.com/artifact/org.json/json/20131018
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-20131018.jar ./EKM.java
4. Run
java -cp .:./json-20131018.jar EKM
*///Import required classesimportjava.net.*;importjava.io.*;importorg.json.*;publicclassEKM{publicstaticJSONArraycallApi(StringapiRequest)throwsException{// This code accesses the apiRequest URL and converts// the contents to a usable JSON objectURLurl=newURL(apiRequest);URLConnectionconnection=url.openConnection();BufferedReaderin=newBufferedReader(newInputStreamReader(connection.getInputStream()));StringBuilderresponse=newStringBuilder();StringinputLine;while((inputLine=in.readLine())!=null)response.append(inputLine);in.close();JSONArrayjsonObject=newJSONArray(response.toString());returnjsonObject;}publicstaticvoidmain(String[]args)throwsException{/*
Call callApi to create a usable
object named apiObject from the API request URL.
Put the API request URL in the call
*/JSONArrayapiObject=EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");/*
You can access any part of the apiObject using code like this:
String Protocol = apiObject.getJSONObject(0).getString("Protocol");
*/// This just outputs the whole apiObjectSystem.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 loadsfunctionexample(){// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object in the result div// you can use what ever code you would like to work// with the object heredocument.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 apiObjectfunctioncallApi(apiRequest,callback){varxhttp=newXMLHttpRequest();xhttp.onreadystatechange=function(){if(xhttp.readyState==4&&xhttp.status==200){varjsonObject=JSON.parse(xhttp.responseText);callback(jsonObject);}};xhttp.open("GET",apiRequest,true);xhttp.send();}</script></head><bodyonload="example()"><divid="result"/></body></html>

// NodeJS requires the "request" module to access the API// Install by running "npm install request" from the shell prompt// Load "request" modulevarrequest=require("request");// Call the callApi function to create a usable// object named apiObject from the API request URL.// Put the API request URL in the callcallApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*',function(apiObject){// This just displays the object but you can use what ever// code you would like to work with the object hereconsole.log(JSON.stringify(apiObject,null,4));});// This code accesses the apiRequest URL and converts// the contents to a usable JSON object named apiObjectfunctioncallApi(apiRequest,callback){varoptions={method:'GET',uri:apiRequest,timeout:1000*15,strictSSL:false,rejectUnhauthorized:false};request(options,function(error,response,body){if(error){console.log(error);throwerror;}else{varjsonObject=JSON.parse(body);callback(jsonObject);}});}

/*
* Install json-c if its not installed
* https://github.com/json-c/json-c/wiki
*
* Below is command to install json-c on centos
* yum install json-c-devel
*
* Saved this example code to a file named ekm.c
* - Compile
* gcc ekm.c -o ekm -lcurl -ljson-c
* - Run
* ./ekm
*
*/// Required Includes
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h> //your directory may vary depending on your OS
#include <json/json.h> //your directory may vary
// End Includes
// Code reqired for curl
structstring{char*data;size_tlen;};voidinit_string(structstring*response){response->len=0;response->data=(char*)malloc(response->len+1);if(response->data==NULL){fprintf(stderr,"malloc() failed\n");exit(EXIT_FAILURE);}response->data[0]='\0';}size_tcurlData(void*data,size_tsize,size_tnmemb,structstring*response){size_tnew_len=response->len+size*nmemb;response->data=(char*)realloc(response->data,new_len+1);if(response->data==NULL){fprintf(stderr,"realloc() failed\n");exit(EXIT_FAILURE);}memcpy(response->data+response->len,data,size*nmemb);response->data[new_len]='\0';response->len=new_len;returnsize*nmemb;}// End required Curl coding
// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
structjson_object*callAPI(constchar*url){CURL*curl;CURLcoderes;json_object*jsonObject;curl=curl_easy_init();if(curl){structstringresponse;init_string(&response);curl_easy_setopt(curl,CURLOPT_URL,url);curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,curlData);curl_easy_setopt(curl,CURLOPT_WRITEDATA,&response);res=curl_easy_perform(curl);if(CURLE_OK==res){jsonObject=json_tokener_parse(response.data);}free(response.data);}curl_easy_cleanup(curl);curl_global_cleanup();returnjsonObject;}intmain(void){// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
json_object*apiObject=callAPI("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");// This just displays the object but you can use what ever
// code you would like to work with the object here
intarraylen=json_object_array_length(apiObject);/*Getting the length of the array*/json_object*summary;inti;printf("Complete Summary Object:\n");for(i=0;i<arraylen;i++){summary=json_object_array_get_idx(apiObject,i);/*Getting the array element at position i*/printf("\n%s",json_object_to_json_string_ext(summary,JSON_C_TO_STRING_PRETTY));}// This example digs deaper into the JSON and displays the first
// kwh_tot_max value for the first summary read
json_object*kwh_tot_max;summary=json_object_array_get_idx(apiObject,0);json_object_object_get_ex(summary,"kWh_Tot_Max",&kwh_tot_max);printf("\nkWh_Tot_Max: %s",json_object_to_json_string_ext(kwh_tot_max,JSON_C_TO_STRING_PRETTY));return0;}

You can filter for just the summary fields you are interested in by using fields=FIELDS parameter in the http address.

In the example below we are only interested in finding out the kWh_Tot and RMS_Volts_ln_1. To retrieve the data associated with the different fields use the abbreviated name of the fields you are interested in after the fields parameter, followed by a tilde separator ( ~ ), or a comma ( , ), if calling for more than one field.

As you can see from the example above that when you append the asterisk ( * ) at the end of the fields name it returns all the associated values with that given fields.

For example, when you call the fields kWh_Tot* the results will include the values of DeltaMin, DeltaMax, Min, Max and Diff.

If you do not want to have all the fields results show in your query, or if you are only interested in a specific fields value you can call it by including the value at the end of the fields name instead of using the asterisk ( * ).