NAV
Command Line Ruby Python PHP Perl Java C NodeJS Javascript

Introduction

Welcome to the EKM METERING API!

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

The EKM API is organized around Representational State Transfer, or REST. You can use our Application Programming Interface, or API, to access EKM API endpoints, which can get you information on various EKM Push meter 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 modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = callApi('URI Here')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

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

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

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

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

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('URL Here', function (apiObject) {


        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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

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.

We also have a Realtime API Request Builder Tool found here: http://apibuilder.ekmmetering.com

Realtime HTTP Request

HTTP Request

curl -s
"http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));     

    return 0;
}

The above example returns the following results:

{
  "readMeter": {
    "Requested":1,
    "ReadSet":[
      {
      "Meter":"10068",
      "Group":1010,
      "Interval":1,
      "Protocol":"v3",
      "MAC_Addr":"40:16:fa:01:00:06",
      "Tz_Offset_Sec":0,
      "Bad_Reads":0,
      "Good_Reads":1,
      "Credits":1000000,
      "ReadData": [
        {
        "Good":1,
        "Date":"2015-11-04",
        "Time":"18:54:57.235",
        "Time_Stamp_UTC_ms":1446663297235,
        "Firmware":"13",
        "Model":"1710",
        "kWh_Tot":"104042.7",
        "kWh_Tariff_1":"68443.6",
        "kWh_Tariff_2":"35599.1",
        "Rev_kWh_Tot":"31567.1",
        "Rev_kWh_Tariff_1":"21351.6",
        "Rev_kWh_Tariff_2":"10215.5",
        "RMS_Volts_Ln_1":"123.7",
        "RMS_Volts_Ln_2":"123.8",
        "Amps_Ln_1":"1.2",
        "Amps_Ln_2":"3.0",
        "RMS_Watts_Ln_1":"130",
        "RMS_Watts_Ln_2":"310",
        "RMS_Watts_Tot":"440",
        "Power_Factor_Ln_1":"100",
        "Power_Factor_Ln_2":"103",
        "Power_Factor_Ln_3":"200",
        "RMS_Watts_Max_Demand":"15055",
        "Max_Demand_Period":"1",
        "CT_Ratio":"200",
        "Meter_Status_Code":"30"
        }
        ]
      }
      ]
    }
}                                                          

{"readMeter"=>
  {"Requested"=>1,
   "ReadSet"=>
    [{"Meter"=>"10068",
      "Group"=>1010,
      "Interval"=>1,
      "Protocol"=>"v3",
      "MAC_Addr"=>"40:16:fa:01:00:06",
      "Tz_Offset_Sec"=>0,
      "Bad_Reads"=>0,
      "Good_Reads"=>1,
      "Credits"=>1000000,
      "ReadData"=>
       [{"Good"=>1,
         "Date"=>"2015-11-25",
         "Time"=>"20:35:23.484",
         "Time_Stamp_UTC_ms"=>1448483723484,
         "Firmware"=>"13",
         "Model"=>"1710",
         "kWh_Tot"=>"105188.1",
         "kWh_Tariff_1"=>"69269.0",
         "kWh_Tariff_2"=>"35919.1",
         "Rev_kWh_Tot"=>"32018.7",
         "Rev_kWh_Tariff_1"=>"21679.9",
         "Rev_kWh_Tariff_2"=>"10338.8",
         "RMS_Volts_Ln_1"=>"124.1",
         "RMS_Volts_Ln_2"=>"124.1",
         "Amps_Ln_1"=>"1.6",
         "Amps_Ln_2"=>"3.4",
         "RMS_Watts_Ln_1"=>"204",
         "RMS_Watts_Ln_2"=>"382",
         "RMS_Watts_Tot"=>"586",
         "Power_Factor_Ln_1"=>"100",
         "Power_Factor_Ln_2"=>"100",
         "Power_Factor_Ln_3"=>"200",
         "RMS_Watts_Max_Demand"=>"15055",
         "Max_Demand_Period"=>"1",
         "CT_Ratio"=>"200",
         "Meter_Status_Code"=>"30"}]}]}}
{u'readMeter': {u'ReadSet': [{u'Bad_Reads': 0,
                              u'Credits': 1000000,
                              u'Good_Reads': 1,
                              u'Group': 1010,
                              u'Interval': 1,
                              u'MAC_Addr': u'40:16:fa:01:00:06',
                              u'Meter': u'10068',
                              u'Protocol': u'v3',
                              u'ReadData': [{u'Amps_Ln_1': u'1.6',
                                             u'Amps_Ln_2': u'4.4',
                                             u'CT_Ratio': u'200',
                                             u'Date': u'2015-11-22',
                                             u'Firmware': u'13',
                                             u'Good': 1,
                                             u'Max_Demand_Period': u'1',
                                             u'Meter_Status_Code': u'30',
                                             u'Model': u'1710',
                                             u'Power_Factor_Ln_1': u'99',
                                             u'Power_Factor_Ln_2': u'100',
                                             u'Power_Factor_Ln_3': u'200',
                                             u'RMS_Volts_Ln_1': u'119.8',
                                             u'RMS_Volts_Ln_2': u'119.7',
                                             u'RMS_Watts_Ln_1': u'188',
                                             u'RMS_Watts_Ln_2': u'510',
                                             u'RMS_Watts_Max_Demand': u'15055',
                                             u'RMS_Watts_Tot': u'698',
                                             u'Rev_kWh_Tariff_1': u'21638.2',
                                             u'Rev_kWh_Tariff_2': u'10319.4',
                                             u'Rev_kWh_Tot': u'31957.6',
                                             u'Time': u'00:05:59.832',
                                             u'Time_Stamp_UTC_ms': 1448150759832,
                                             u'kWh_Tariff_1': u'69144.9',
                                             u'kWh_Tariff_2': u'35863.6',
                                             u'kWh_Tot': u'105008.5'}],
                              u'Tz_Offset_Sec': 0}],
                u'Requested': 1}}
object(stdClass)#1 (1) {
  ["readMeter"]=>
  object(stdClass)#2 (2) {
    ["Requested"]=>
    int(1)
    ["ReadSet"]=>
    array(1) {
      [0]=>
      object(stdClass)#3 (10) {
        ["Meter"]=>
        string(5) "10068"
        ["Group"]=>
        int(1010)
        ["Interval"]=>
        int(1)
        ["Protocol"]=>
        string(2) "v3"
        ["MAC_Addr"]=>
        string(17) "40:16:fa:01:00:06"
        ["Tz_Offset_Sec"]=>
        int(0)
        ["Bad_Reads"]=>
        int(0)
        ["Good_Reads"]=>
        int(1)
        ["Credits"]=>
        int(1000000)
        ["ReadData"]=>
        array(1) {
          [0]=>
          object(stdClass)#4 (26) {
            ["Good"]=>
            int(1)
            ["Date"]=>
            string(10) "2015-11-21"
            ["Time"]=>
            string(12) "22:39:05.881"
            ["Time_Stamp_UTC_ms"]=>
            int(1448145545881)
            ["Firmware"]=>
            string(2) "13"
            ["Model"]=>
            string(4) "1710"
            ["kWh_Tot"]=>
            string(8) "105006.6"
            ["kWh_Tariff_1"]=>
            string(7) "69143.5"
            ["kWh_Tariff_2"]=>
            string(7) "35863.1"
            ["Rev_kWh_Tot"]=>
            string(7) "31957.3"
            ["Rev_kWh_Tariff_1"]=>
            string(7) "21637.9"
            ["Rev_kWh_Tariff_2"]=>
            string(7) "10319.4"
            ["RMS_Volts_Ln_1"]=>
            string(5) "120.2"
            ["RMS_Volts_Ln_2"]=>
            string(5) "120.3"
            ["Amps_Ln_1"]=>
            string(3) "1.2"
            ["Amps_Ln_2"]=>
            string(4) "12.6"
            ["RMS_Watts_Ln_1"]=>
            string(3) "128"
            ["RMS_Watts_Ln_2"]=>
            string(4) "1518"
            ["RMS_Watts_Tot"]=>
            string(4) "1648"
            ["Power_Factor_Ln_1"]=>
            string(3) "100"
            ["Power_Factor_Ln_2"]=>
            string(3) "100"
            ["Power_Factor_Ln_3"]=>
            string(3) "200"
            ["RMS_Watts_Max_Demand"]=>
            string(5) "15055"
            ["Max_Demand_Period"]=>
            string(1) "1"
            ["CT_Ratio"]=>
            string(3) "200"
            ["Meter_Status_Code"]=>
            string(2) "30"
          }
        }
      }
    }
  }
}
$VAR1 = {
          'readMeter' => {
                           'Requested' => 1,
                           'ReadSet' => [
                                          {
                                            'ReadData' => [
                                                            {
                                                              'RMS_Volts_Ln_1' => '122.7',
                                                              'Power_Factor_Ln_3' => '200',
                                                              'Time' => '02:03:39.167',
                                                              'Rev_kWh_Tot' => '34058.0',
                                                              'RMS_Watts_Tot' => '650',
                                                              'CT_Ratio' => '200',
                                                              'RMS_Volts_Ln_2' => '122.8',
                                                              'Model' => '1710',
                                                              'Time_Stamp_UTC_ms' => '1457316219167',
                                                              'kWh_Tariff_2' => '37502.6',
                                                              'Power_Factor_Ln_2' => '100',
                                                              'Firmware' => '13',
                                                              'RMS_Watts_Max_Demand' => '15055',
                                                              'Rev_kWh_Tariff_1' => '23133.9',
                                                              'Amps_Ln_2' => '3.6',
                                                              'RMS_Watts_Ln_2' => '398',
                                                              'Good' => 1,
                                                              'Amps_Ln_1' => '2.0',
                                                              'Meter_Status_Code' => '30',
                                                              'Date' => '2016-03-07',
                                                              'RMS_Watts_Ln_1' => '250',
                                                              'kWh_Tariff_1' => '73008.4',
                                                              'Rev_kWh_Tariff_2' => '10924.1',
                                                              'kWh_Tot' => '110511.0',
                                                              'Max_Demand_Period' => '1',
                                                              'Power_Factor_Ln_1' => '100'
                                                            }
                                                          ],
                                            'MAC_Addr' => '40:16:fa:01:00:06',
                                            'Interval' => 1,
                                            'Tz_Offset_Sec' => 0,
                                            'Credits' => 1000000,
                                            'Bad_Reads' => 0,
                                            'Group' => 1010,
                                            'Meter' => '10068',
                                            'Protocol' => 'v3',
                                            'Good_Reads' => 1
                                          }
                                        ]
                         }
        };
{"readMeter": {
    "Requested": 1,
    "ReadSet": [{
        "Good_Reads": 1,
        "Group": 1010,
        "Credits": 1000000,
        "Meter": "10068",
        "Bad_Reads": 0,
        "Protocol": "v3",
        "ReadData": [{
            "kWh_Tot": "105108.9",
            "Rev_kWh_Tariff_2": "10326.7",
            "Rev_kWh_Tariff_1": "21666.4",
            "Max_Demand_Period": "1",
            "Time": "19:57:32.449",
            "Meter_Status_Code": "30",
            "Amps_Ln_1": "1.2",
            "Amps_Ln_2": "2.4",
            "RMS_Volts_Ln_1": "121.9",
            "RMS_Volts_Ln_2": "121.8",
            "RMS_Watts_Max_Demand": "15055",
            "CT_Ratio": "200",
            "Firmware": "13",
            "RMS_Watts_Tot": "348",
            "Time_Stamp_UTC_ms": 1448308652449,
            "Power_Factor_Ln_3": "200",
            "Power_Factor_Ln_2": "108",
            "Power_Factor_Ln_1": "100",
            "kWh_Tariff_2": "35886.7",
            "kWh_Tariff_1": "69222.2",
            "Date": "2015-11-23",
            "RMS_Watts_Ln_1": "144",
            "Rev_kWh_Tot": "31993.1",
            "RMS_Watts_Ln_2": "204",
            "Model": "1710",
            "Good": 1
        }],
        "Tz_Offset_Sec": 0,
        "Interval": 1,
        "MAC_Addr": "40:16:fa:01:00:06"
    }]
}}
{
    "readMeter": {
        "Requested": 1,
        "ReadSet": [
            {
                "Meter": "10068",
                "Group": 1010,
                "Interval": 1,
                "Protocol": "v3",
                "MAC_Addr": "40:16:fa:01:00:06",
                "Tz_Offset_Sec": 0,
                "Bad_Reads": 0,
                "Good_Reads": 1,
                "Credits": 1000000,
                "ReadData": [
                    {
                        "Good": 1,
                        "Date": "2015-11-22",
                        "Time": "01:52:44.853",
                        "Time_Stamp_UTC_ms": 1448157164853,
                        "Firmware": "13",
                        "Model": "1710",
                        "kWh_Tot": "105011.6",
                        "kWh_Tariff_1": "69148.0",
                        "kWh_Tariff_2": "35863.6",
                        "Rev_kWh_Tot": "31958.3",
                        "Rev_kWh_Tariff_1": "21638.9",
                        "Rev_kWh_Tariff_2": "10319.4",
                        "RMS_Volts_Ln_1": "121.1",
                        "RMS_Volts_Ln_2": "121.2",
                        "Amps_Ln_1": "1.8",
                        "Amps_Ln_2": "8.8",
                        "RMS_Watts_Ln_1": "204",
                        "RMS_Watts_Ln_2": "1046",
                        "RMS_Watts_Tot": "1250",
                        "Power_Factor_Ln_1": "100",
                        "Power_Factor_Ln_2": "99",
                        "Power_Factor_Ln_3": "200",
                        "RMS_Watts_Max_Demand": "15055",
                        "Max_Demand_Period": "1",
                        "CT_Ratio": "200",
                        "Meter_Status_Code": "30"
                    }
                ]
            }
        ]
    }
}
/*
{
    "readMeter": {
        "Requested": 1,
        "ReadSet": [
            {
                "Meter": "10068",
                "Group": 1010,
                "Interval": 1,
                "Protocol": "v3",
                "MAC_Addr": "40:16:fa:01:00:06",
                "Tz_Offset_Sec": 0,
                "Bad_Reads": 0,
                "Good_Reads": 1,
                "Credits": 1000000,
                "ReadData": [
                    {
                        "Good": 1,
                        "Date": "2015-11-22",
                        "Time": "00:54:56.845",
                        "Time_Stamp_UTC_ms": 1448153696845,
                        "Firmware": "13",
                        "Model": "1710",
                        "kWh_Tot": "105009.7",
                        "kWh_Tariff_1": "69146.1",
                        "kWh_Tariff_2": "35863.6",
                        "Rev_kWh_Tot": "31957.9",
                        "Rev_kWh_Tariff_1": "21638.5",
                        "Rev_kWh_Tariff_2": "10319.4",
                        "RMS_Volts_Ln_1": "120.5",
                        "RMS_Volts_Ln_2": "120.5",
                        "Amps_Ln_1": "1.8",
                        "Amps_Ln_2": "5.2",
                        "RMS_Watts_Ln_1": "202",
                        "RMS_Watts_Ln_2": "608",
                        "RMS_Watts_Tot": "810",
                        "Power_Factor_Ln_1": "101",
                        "Power_Factor_Ln_2": "100",
                        "Power_Factor_Ln_3": "200",
                        "RMS_Watts_Max_Demand": "15055",
                        "Max_Demand_Period": "1",
                        "CT_Ratio": "200",
                        "Meter_Status_Code": "30"
                    }
                ]
            }
        ]
    }
}
*/
Complete readMeter Object:
{
  "Requested":1,
  "ReadSet":[
    {
      "Meter":"10068",
      "Group":1010,
      "Interval":1,
      "Protocol":"v3",
      "MAC_Addr":"40:16:fa:01:00:06",
      "Tz_Offset_Sec":0,
      "Bad_Reads":0,
      "Good_Reads":1,
      "Credits":1000000,
      "ReadData":[
        {
          "Good":1,
          "Date":"2015-11-27",
          "Time":"21:37:11.850",
          "Time_Stamp_UTC_ms":1448660231850,
          "Firmware":"13",
          "Model":"1710",
          "kWh_Tot":"105300.0",
          "kWh_Tariff_1":"69346.0",
          "kWh_Tariff_2":"35954.0",
          "Rev_kWh_Tot":"32063.6",
          "Rev_kWh_Tariff_1":"21711.0",
          "Rev_kWh_Tariff_2":"10352.6",
          "RMS_Volts_Ln_1":"124.0",
          "RMS_Volts_Ln_2":"124.0",
          "Amps_Ln_1":"6.8",
          "Amps_Ln_2":"3.8",
          "RMS_Watts_Ln_1":"730",
          "RMS_Watts_Ln_2":"448",
          "RMS_Watts_Tot":"1180",
          "Power_Factor_Ln_1":"114",
          "Power_Factor_Ln_2":"100",
          "Power_Factor_Ln_3":"200",
          "RMS_Watts_Max_Demand":"15055",
          "Max_Demand_Period":"1",
          "CT_Ratio":"200",
          "Meter_Status_Code":"30"
        }
      ]
    }
  ]
}
kWh_Tot: "105300.0"

All http requests will begin with the following information in the http address:

http://io.ekmpush.com/readMeter/

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

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

HTTP Address Description
http://io.ekmpush.com/readMeter? Beginning of the http address
meters Parameter for calling the meter
10068 Exact meter number to call
ver Parameter for stating version of meter to query
v3 Meter version number (v3,v4)
key Parameter for calling the key
MTAxMDoyMDIw EKM Push authorization key
fmt Parameter expecting the file format to return as
html Language format to return the data as (html,xml,json,csv)
cnt Parameter for expecting how many meter readings to call
1 Exact number of meter readings

Here is an example URL:

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=1

Click to try

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.

Get a Specific EKM Meter

curl -s
"http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=json&cnt=10"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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

In the example below the METER_ID being used is: 300000369

http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10


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

http://io.ekmpush.com/readMeter?meters=300000369&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10

Click to try


URL Parameters

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

Realtime Query Multiple Meters

Query Multiple Meters

curl -s
"http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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

http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10


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.

http://io.ekmpush.com/readMeter?meters=10068~10054&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10

Click to try


Realtime Output Formats

Output format: XML

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=xml&cnt=1

The above URL returns XML structured like this:

<readMeter Requested="1">
<ReadSet Meter="10068" Group="1010" Interval="1" Protocol="v3" MAC_Addr="40:16:fa:01:00:06" Tz_Offset_Sec="0" Bad_Reads="0" Good_Reads="1" Credits="1000000">
<ReadData Good="1" Date="2015-11-04" Time="19:15:12.208" Time_Stamp_UTC_ms="1446664512208" Firmware="13" Model="1710" kWh_Tot="104043.0" kWh_Tariff_1="68443.6" kWh_Tariff_2="35599.4" Rev_kWh_Tot="31567.2" Rev_kWh_Tariff_1="21351.6" Rev_kWh_Tariff_2="10215.6" RMS_Volts_Ln_1="122.8" RMS_Volts_Ln_2="122.8" Amps_Ln_1="1.2" Amps_Ln_2="13.0" RMS_Watts_Ln_1="130" RMS_Watts_Ln_2="1596" RMS_Watts_Tot="1726" Power_Factor_Ln_1="100" Power_Factor_Ln_2="100" Power_Factor_Ln_3="200" RMS_Watts_Max_Demand="15055" Max_Demand_Period="1" CT_Ratio="200" Meter_Status_Code="30"/>
</ReadSet>
</readMeter>

Output format: JSON

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1

The above URL returns JSON structured like this:

{
  "readMeter": {
    "Requested":1,
    "ReadSet":[
      {
      "Meter":"10068",
      "Group":1010,
      "Interval":1,
      "Protocol":"v3",
      "MAC_Addr":"40:16:fa:01:00:06",
      "Tz_Offset_Sec":0,
      "Bad_Reads":0,
      "Good_Reads":1,
      "Credits":1000000,
      "ReadData": [
        {
        "Good":1,
        "Date":"2015-11-04",
        "Time":"19:20:30.202",
        "Time_Stamp_UTC_ms":1446664830202,
        "Firmware":"13",
        "Model":"1710",
        "kWh_Tot":"104043.1",
        "kWh_Tariff_1":"68443.6",
        "kWh_Tariff_2":"35599.5",
        "Rev_kWh_Tot":"31567.2",
        "Rev_kWh_Tariff_1":"21351.6",
        "Rev_kWh_Tariff_2":"10215.6",
        "RMS_Volts_Ln_1":"124.9",
        "RMS_Volts_Ln_2":"124.9",
        "Amps_Ln_1":"1.2",
        "Amps_Ln_2":"2.8",
        "RMS_Watts_Ln_1":"132",
        "RMS_Watts_Ln_2":"288",
        "RMS_Watts_Tot":"422",
        "Power_Factor_Ln_1":"100",
        "Power_Factor_Ln_2":"103",
        "Power_Factor_Ln_3":"200",
        "RMS_Watts_Max_Demand":"15055",
        "Max_Demand_Period":"1",
        "CT_Ratio":"200",
        "Meter_Status_Code":"30"
        }
        ]
      }
      ]
    }
}

Output format: CSV

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=csv&cnt=1

The above URL returns CSV structured like this:

Meter,Date,Time,Time_Stamp_UTC_ms,kWh_Tot,kWh_Tariff_1,kWh_Tariff_2,Rev_kWh_Tot,Rev_kWh_Tariff_1,Rev_kWh_Tariff_2,RMS_Volts_Ln_1,RMS_Volts_Ln_2,Amps_Ln_1,Amps_Ln_2,RMS_Watts_Ln_1,RMS_Watts_Ln_2,RMS_Watts_Tot,Power_Factor_Ln_1,Power_Factor_Ln_2,Power_Factor_Ln_3,RMS_Watts_Max_Demand,CT_Ratio
10068,11/04/2015,19:30:39,1446665439231,104043.3,68443.6,35599.7,31567.3,21351.6,10215.7,124.0,124.1,1.2,4.0,132,468,600,100,100,200,15055,200

You can call up different output formats to return the meter data in. These formats can be: html, xml, json and csv.

To retrieve the different formats, all that is required is to change the FORMAT (written as fmt in the http address), to the type you want to call:

Example URL http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=FORMAT&cnt=1&tz=America~Los_Angeles


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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=1&tz=America~Los_Angeles

Click to try


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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=xml&cnt=1&tz=America~Los_Angeles

Click to try


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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1&tz=America~Los_Angeles

Click to try


Click the link below to download the meter data in the CSV format ( Comma Separated Values )

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=csv&cnt=1&tz=America~Los_Angeles

Click to try


URL Parameters

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

Realtime Number of Meter Reads

Number of Meter Readings

curl -s
"http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=1000"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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.

http://io.ekmpush.com/readMeter?ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=READ_COUNT

Replace READ_COUNT with the number 10 to call the amount of meter data to read.

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10


The link below will show the example of the meter data that is associated with the provided key and the specified number of 10 meter data readings. It will display it as html data.

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10

Click to try


You can also request anywhere from 1 to 1000 meter reads from any given meter with the following format:

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=READ_COUNT

For 1 meter reading replace READ_COUNT with the number 1 as in the example below:

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=1

Click to try


or for 1000 meter readings replace READ_COUNT with the number 1000 as in the example below:

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=1000

Click to try


URL Parameters

Parameters Description
cnt Number of meter reads to display

Realtime Time Zones

Time Zones

curl -s
"http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call

# This just displays the object but you can use what ever
# code you would like to work with the object here
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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:

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=TIME_ZONE

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

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


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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles

Click to try


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

Click for Time Zone Information

URL Parameters

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

Realtime Timestamp Call

Timestamp Data Call

curl -s
"http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=json&cnt=10&tz=America~Los_Angeles&since=1415218436919"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&until=UNTIL

You can also use the filter “since”: since=Time

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&since=SINCE

The Time can either be the current time or a previous period in time that you want to obtain a specific meter data reading. The time will be formatted in milliseconds.

Example below is how the 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.

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&since=1415218436919

URL Parameters

Parameter Description
since or until Since the last call or Until a certain call. The timestamp is in UTC Time ( computer time ), formatted in milliseconds.

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

Start Date & End Date

curl -s
"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"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
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', function (apiObject) {


        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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.

http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&start_date=DDMMYYYY&end_date=DDMMYYYY

Date Parameter

Parameter Description
dd Indicates the day of the month. Example: 06, for the sixth day of the month.
mm Indicates the month to be called. Example: 11, for the month of November.
yyyy Indicates the year to be called. Example: 2015, for the year 2015.

Let’s say you would like to pull the meter reading data for November 06, 2015 to November 07, 2015. Your http address would look like the following:

http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&start_date=06112015&end_date=07112015

URL Parameters

Parameter Description
start_date Date for the meter reading to begin. Example of ddmmyyyy is as follows: 06112015 = November 6, 2015
end_date Data for the meter reading to end. Example of ddmmyyyy is as follows: 07112015 = November 7, 2015

Realtime Start Time & End Time

Start Time & End Time

curl -s
"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"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
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', function (apiObject) {


        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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

This format is similar to the start and end date http request.

http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&start_date=30042015&start_time=HHMMSS&end_time=HHMMSS

Time Parameters

Parameter Description
hh Indicates the hours of the day. Example: 0600, for 6:00 A.M.
mm Indicates the minutes of the hour. Example: 0624, for 24 minutes into the hour of 6:00 A.M. or 6:24 A.M.
ss Indicates the seconds of the minute. Example: 062430, for 30 seconds into the minute of 24, or 6:24.30 A.M.

If you want to pull the meter reading data for a specific period of the day, let’s say for 062400 A.M. to 062500 A.M., then your http address would look like the following:

http://io.ekmpush.com/readMeter??meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&start_time=062400&end_time=062500


You can also call data from any number of seconds ago. The example below will call all available data from 300 seconds ago.

Instead of adding the start_time and end_time parameter use the back=seconds parameter.

http://io.ekmpush.com/readMeter?meters=300001290&ver=v4&key=MTAxMDoyMDIw&fmt=html&cnt=1000&tz=America~Los_Angeles&back=300

Click to try


URL Parameters

Parameter Description
start_time Time to begin the data call. Format in which the time is written in: hhmmss - hours, minutes, seconds. Example: 062400 = 6:24.00 A.M.
end_time Time to end the data call. Format in which the time is written in: hhmmss- hours, minutes, seconds. Example: 062500 = 6:25.00 A.M.
back Time in seconds, up to 300 seconds

Realtime Fields

Fields

curl -s
"http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&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
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&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
import pprint
pprint.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=html&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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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 here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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));       

    return 0;
}

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

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&fields=FIELDS


In the example below we are only interested in finding out the Total Kilowatt Hours, Reverse kWh, and Total Watts. To retrieve the data associated with the different fields use the abbreviated name of the field you are interested in after the fields parameter, followed by a tilde separator if calling for more than one field.

http://io.ekmpush.com/readMeter?meters=10068&ver=v3&key=MTAxMDoyMDIw&fmt=html&cnt=10&tz=America~Los_Angeles&fields=kWh_Tot~Rev_kWh_Tot~RMS_Watts_Tot

Click to try


The data fields that you are interested in is not limited to these three in the example above. You can add just one field or include as many as your needs require.

URL Parameters

The fields below are for the v3 and v4 meters

Fields Description
kWh_Tot Total kWh
kWh_Tariff_1 kWh for Tariff 1
kWh_Tariff_2 kWh for Tariff 2
kWh_Tariff_3 kWh for Tariff 3
kWh_Tariff_4 kWh for Tariff 4
Rev_kWh_Tot Total Reverse kWh
Rev_kWh_Tariff_1 Reverse kWh for Tariff 1
Rev_kWh_Tariff_2 Reverse kWh for Tariff 2
Rev_kWh_Tariff_3 Reverse kWh for Tariff 3
Rev_kWh_Tariff_4 Reverse kWh for Tariff 4
RMS_Volts_Ln_1 Volts on line 1
RMS_Volts_Ln_2 Volts on line 2
RMS_Volts_Ln_3 Volts on line 3
Amps_Ln_1 Amps on line 1
Amps_Ln_2 Amps on line 2
Amps_Ln_3 Amps on line 3
Power_Factor_Ln_1 Power Factor on line 1
Power_Factor_Ln_2 Power Factor on line 2
Power_Factor_Ln_3 Power Factor on line 3
RMS_Watts_Ln_1 Watts on line 1
RMS_Watts_Ln_2 Watts on line 2
RMS_Watts_Ln_3 Watts on line 3
RMS_Watts_Tot Total Watts (all lines)
RMS_Watts_Max_Demand Max Demand
Max_Demand_Period Max Demand Period
15 min = 1
30 min = 2
Hour = 3
CT_Ratio CT Ratio

The fields below are additional fields only for the v4 meter

Fields Description
Pulse_Cnt_1 Pulse Count on input 1
Pulse_Cnt_2 Pulse Count on input 2
Pulse_Cnt_3 Pulse Count on input 3
Pulse_Ratio_1 Pulse Input Ratio on input 1
Pulse_Ratio_2 Pulse Input Ratio on input 2
Pulse_Ratio_3 Pulse Input Ratio on input 3
State_In State of inputs
Line1/Line2/Line3
High/High/High = 0
High/High/Low = 1
High/Low/High = 2
High/Low/Low = 3
Low/High/High = 4
Low/High/Low = 5
Low/Low/High = 6
Low/Low/Low = 7
Reactive_Energy_Tot Total kVARh
kWh_Rst Resettable kWh
Rev_kWh_Rst Resettable Reverse kWh
kWh_Scale Decimal places for kWh
0 Decimal Places = 0
1 Decimal Place = 1
2 Decimal Places = 2
Reactive_Pwr_Ln_1 VAR on line 1
Reactive_Pwr_Ln_2 VAR on line 2
Reactive_Pwr_Ln_3 VAR on line 3
Reactive_Pwr_Tot Total VAR
Line_Freq Frequency (Hz)
State_Watts_Dir Real-time direction of current
Line1/Line2/Line3
Forward/Forward/Forward = 1
Forward/Forward/Reverse = 2
Forward/Reverse/Forward = 3
Reverse/Forward/Forward = 4
Forward/Reverse/Reverse = 5
Reverse/Forward/Reverse = 6
Reverse/Reverse/Forward = 7
Reverse/Reverse/Reverse = 8
State_Out State of outputs
OFF/OFF = 1
OFF/ON = 2
ON/OFF = 3
ON/ON = 4
kWh_Ln_1 Total kWh on line 1
kWh_Ln_2 Total kWh on line 2
kWh_Ln_3 Total kWh on line 3
Rev_kWh_Ln_1 Reverse kWh on line 1
Rev_kWh_Ln_2 Reverse kWh on line 2
Rev_kWh_Ln_3 Reverse kWh on line 3
Max_Demand_Rst Max Demand auto reset status
OFF = 0
Monthly = 1
Weekly = 2
Daily = 3
Hourly = 4
Net_Calc_Watts_Ln_1 Net Watts on line 1
Net_Calc_Watts_Ln_2 Net Watts on line 2
Net_Calc_Watts_Ln_3 Net Watts on line 3
Net_Calc_Watts_Tot Total Net Watts
CF_Ratio Settable Pulse Output Ratio

Realtime Secure HTTPS

Secure HTTPS

curl -s
"https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('io.ekmpush.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10')

# This just displays the object but you can use what ever
# code you would like to work with the object here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10")

# This just displays the object but you can use what ever
# code you would like to work with the object here
import pprint
pprint.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=30000036&ver=v4&key=MTExOjExMQ&fmt=html&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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("https://io.ekmpush.com/readMeter?meters=30000036&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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10', function (apiObject) {


        // This just displays the object but you can use what ever
        // code you would like to work with the object here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=30000036&ver=v4&key=MTExOjExMQ&fmt=html&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));       

    return 0;
}

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.

Example below is of non-secure http.

http://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10

Example below is of secure http

https://io.ekmpush.com/readMeter?meters=30000036&ver=v4&key=MTExOjExMQ&fmt=html&cnt=10

URL Parameters

Parameter Description
HTTP Non Secure
HTTPS Secure

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.

We also have a Summary API Request Builder Tool found here: http://summary.ekmpush.com/api-builder

Summary HTTP Request

Summary API request example

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&fields=kWh_Tot*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));     

    return 0;
}

The above example returns the following results:


[
   {
      "Start_Time_Stamp_UTC_ms": 1453228205396,
      "End_Time_Stamp_UTC_ms": 1453229103429,
      "End_Date": "Tue Jan 19 2016 18:45:03 GMT+0000 (GMT)",
      "Start_Date": "Tue Jan 19 2016 18:30:05 GMT+0000 (GMT)",
      "Meter": "10068",
      "Protocol": "v3",
      "Count": 899,
      "kWh_Tot_DeltaMin": 0,
      "kWh_Tot_DeltaMax": 0.1,
      "kWh_Tot_Min": 108109.9,
      "kWh_Tot_Max": 108110.2,
      "kWh_Tot_Diff": 0.3
   }
]


[{"Start_Time_Stamp_UTC_ms"=>1453229104389,
  "End_Time_Stamp_UTC_ms"=>1453230002422,
  "End_Date"=>"Tue Jan 19 2016 19:00:02 GMT+0000 (GMT)",
  "Start_Date"=>"Tue Jan 19 2016 18:45:04 GMT+0000 (GMT)",
  "Meter"=>"10068",
  "Protocol"=>"v3",
  "Count"=>899,
  "kWh_Tot_DeltaMin"=>0,
  "kWh_Tot_DeltaMax"=>0.1,
  "kWh_Tot_Min"=>108110.2,
  "kWh_Tot_Max"=>108110.7,
  "kWh_Tot_Diff"=>0.5}]


[{u'Count': 899,
  u'End_Date': u'Tue Jan 19 2016 19:00:02 GMT+0000 (GMT)',
  u'End_Time_Stamp_UTC_ms': 1453230002422,
  u'Meter': u'10068',
  u'Protocol': u'v3',
  u'Start_Date': u'Tue Jan 19 2016 18:45:04 GMT+0000 (GMT)',
  u'Start_Time_Stamp_UTC_ms': 1453229104389,
  u'kWh_Tot_DeltaMax': 0.10000000000000001,
  u'kWh_Tot_DeltaMin': 0,
  u'kWh_Tot_Diff': 0.5,
  u'kWh_Tot_Max': 108110.7,
  u'kWh_Tot_Min': 108110.2}]


array(1) {
  [0]=>
  object(stdClass)#1 (12) {
    ["Start_Time_Stamp_UTC_ms"]=>
    int(1453229104389)
    ["End_Time_Stamp_UTC_ms"]=>
    int(1453230002422)
    ["End_Date"]=>
    string(39) "Tue Jan 19 2016 19:00:02 GMT+0000 (GMT)"
    ["Start_Date"]=>
    string(39) "Tue Jan 19 2016 18:45:04 GMT+0000 (GMT)"
    ["Meter"]=>
    string(5) "10068"
    ["Protocol"]=>
    string(2) "v3"
    ["Count"]=>
    int(899)
    ["kWh_Tot_DeltaMin"]=>
    int(0)
    ["kWh_Tot_DeltaMax"]=>
    float(0.1)
    ["kWh_Tot_Min"]=>
    float(108110.2)
    ["kWh_Tot_Max"]=>
    float(108110.7)
    ["kWh_Tot_Diff"]=>
    float(0.5)
  }
}

$VAR1 = [
          {
            'End_Time_Stamp_UTC_ms' => '1457315099174',
            'Start_Date' => 'Mon Mar 07 2016 01:30:13 GMT+0000 (GMT)',
            'End_Date' => 'Mon Mar 07 2016 01:44:59 GMT+0000 (GMT)',
            'kWh_Tot_Min' => '110510.1',
            'kWh_Tot_DeltaMin' => 0,
            'Start_Time_Stamp_UTC_ms' => '1457314213175',
            'rejected_duplicates' => 0,
            'rejected_bad' => 0,
            'kWh_Tot_Max' => '110510.4',
            'Count' => 887,
            'kWh_Tot_Diff' => '0.3',
            'Meter' => '10068',
            'Protocol' => 'v3',
            'kWh_Tot_DeltaMax' => '0.1'
          }
        ];

[{
    "Meter": "10068",
    "Count": 899,
    "Start_Date": "Tue Jan 19 2016 18:30:05 GMT+0000 (GMT)",
    "End_Time_Stamp_UTC_ms": 1453229103429,
    "End_Date": "Tue Jan 19 2016 18:45:03 GMT+0000 (GMT)",
    "kWh_Tot_Diff": 0.3,
    "kWh_Tot_Max": 108110.2,
    "kWh_Tot_Min": 108109.9,
    "Start_Time_Stamp_UTC_ms": 1453228205396,
    "kWh_Tot_DeltaMin": 0,
    "Protocol": "v3",
    "kWh_Tot_DeltaMax": 0.1
}]


[
   {
      "Start_Time_Stamp_UTC_ms": 1453228205396,
      "End_Time_Stamp_UTC_ms": 1453229103429,
      "End_Date": "Tue Jan 19 2016 18:45:03 GMT+0000 (GMT)",
      "Start_Date": "Tue Jan 19 2016 18:30:05 GMT+0000 (GMT)",
      "Meter": "10068",
      "Protocol": "v3",
      "Count": 899,
      "kWh_Tot_DeltaMin": 0,
      "kWh_Tot_DeltaMax": 0.1,
      "kWh_Tot_Min": 108109.9,
      "kWh_Tot_Max": 108110.2,
      "kWh_Tot_Diff": 0.3
   }
]


[
    {
        "Start_Time_Stamp_UTC_ms": 1450472404376,
        "End_Time_Stamp_UTC_ms": 1450473303396,
        "End_Date": "Fri Dec 18 2015 21:15:03 GMT+0000 (GMT)",
        "Start_Date": "Fri Dec 18 2015 21:00:04 GMT+0000 (GMT)",
        "Meter": "10068",
        "Protocol": "v3",
        "Count": 900,
        "kWh_Tot_DeltaMin": 0,
        "kWh_Tot_DeltaMax": 0.1,
        "kWh_Tot_Min": 106488.8,
        "kWh_Tot_Max": 106489.2,
        "kWh_Tot_Diff": 0.4
    }
]


{
  "Start_Time_Stamp_UTC_ms":1453228205396,
  "End_Time_Stamp_UTC_ms":1453229103429,
  "End_Date":"Tue Jan 19 2016 18:45:03 GMT+0000 (GMT)",
  "Start_Date":"Tue Jan 19 2016 18:30:05 GMT+0000 (GMT)",
  "Meter":"10068",
  "Protocol":"v3",
  "Count":899,
  "kWh_Tot_DeltaMin":0,
  "kWh_Tot_DeltaMax":0.100000,
  "kWh_Tot_Min":108109.900000,
  "kWh_Tot_Max":108110.200000,
  "kWh_Tot_Diff":0.300000
}
kWh_Tot_Max: 108110.200000

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

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

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

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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=1&field=kWh_Tot*

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

Get a Specific EKM Meter

curl -s
"http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=html&report=15&limit=5&fields=kWh_Tot*"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=html&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
import pprint
pprint.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=html&report=15&limit=5&fields=kWh_Tot*');

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

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

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

}
?>
# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=html&report=15&limit=5&fields=kWh_Tot*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=300000369&key=MTExOjExMQ&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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


In the example below the METER_ID being used is: 300000369

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

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

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

Click to try


URL Parameters

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

Summary Query Multiple Meters

Aggregate

Query Multiple Meters

curl -s
"http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*')

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

 Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) t15ows Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&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 apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        t15ow error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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*");

    // 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));       

    return 0;
}

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

http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*

Click to try


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

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

http://summary.ekmmetering.com/summary?meters=10068,10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*

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

Bulk

Bulk

curl -s
"http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = 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 here
require 'pp'
pp apiObject
 Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 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
import pprint
pprint.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
function callApi ($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) t15ows Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("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 apiObject
        System.out.println(apiObject.toString(4));
    }
}
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

</head>
  <body onload="example()">
    <div id="result"/>
  </body>
</html>
// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        t15ow error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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));       

    return 0;
}

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.

http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=BULK

http://summary.ekmmetering.com/summary?meters=10068~10054&key=MTAxMDoyMDIw&format=html&report=15&limit=5&fields=kWh_Tot*&bulk=1

Click to try


URL Parameter

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

Summary Output Formats

Output Formats


http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=xml&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns XML structured like this:


<summaries>
<summary>
<Start_Time_Stamp_UTC_ms>1451334601376</Start_Time_Stamp_UTC_ms>
<End_Time_Stamp_UTC_ms>1451335503375</End_Time_Stamp_UTC_ms>
<End_Date>Mon Dec 28 2015 20:45:03 GMT+0000 (GMT)</End_Date>
<Start_Date>Mon Dec 28 2015 20:30:01 GMT+0000 (GMT)</Start_Date>
<Meter>10068</Meter>
<Protocol>v3</Protocol>
<Count>903</Count>
<kWh_Tot_DeltaMin>0</kWh_Tot_DeltaMin>
<kWh_Tot_DeltaMax>0.1</kWh_Tot_DeltaMax>
<kWh_Tot_Min>107042</kWh_Tot_Min>
<kWh_Tot_Max>107042.9</kWh_Tot_Max>
<kWh_Tot_Diff>0.9</kWh_Tot_Diff>
</summary>
</summaries>

Output forat: JSON


http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns JSON structured like this:


[
   {
      "Start_Time_Stamp_UTC_ms": 1451334601376,
      "End_Time_Stamp_UTC_ms": 1451335503375,
      "End_Date": "Mon Dec 28 2015 20:45:03 GMT+0000 (GMT)",
      "Start_Date": "Mon Dec 28 2015 20:30:01 GMT+0000 (GMT)",
      "Meter": "10068",
      "Protocol": "v3",
      "Count": 903,
      "kWh_Tot_DeltaMin": 0,
      "kWh_Tot_DeltaMax": 0.1,
      "kWh_Tot_Min": 107042,
      "kWh_Tot_Max": 107042.9,
      "kWh_Tot_Diff": 0.9
   }
]

Output format: CSV


http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=csv&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

The above URL returns CSV structured like this:


"Start_Time_Stamp_UTC_ms","End_Time_Stamp_UTC_ms","End_Date","Start_Date","Meter","Protocol","Count","kWh_Tot_DeltaMin","kWh_Tot_DeltaMax","kWh_Tot_Min","kWh_Tot_Max","kWh_Tot_Diff"
1451334601376,1451335503375,"Mon Dec 28 2015 20:45:03 GMT+0000 (GMT)","Mon Dec 28 2015 20:30:01 GMT+0000 (GMT)","10068","v3",903,0,0.1,107042,107042.9,0.9

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

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

Example URL

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=FORMAT&reports=15&limit=1&timelimit=1&fields=kWh_Tot*


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=xml&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=json&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=csv&reports=15&limit=1&timelimit=1&fields=kWh_Tot*

Click to try


URL Parameters

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

Summary Reports

Reports

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&report=15&fields=kWh_Tot*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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.

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=REPORT&fields=kWh_Tot*


Example for the 15 minute summary report

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&fields=kWh_Tot*

Click to try


Example for the hr

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&fields=kWh_Tot*

Click to try


Example for the dy

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=dy&fields=kWh_Tot*

Click to try


Example for the wk

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&fields=kWh_Tot*

Click to try


Example for the mo

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=mo&fields=kWh_Tot*

Click to try


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

Example URL:

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=mo#&fields=kWh_Tot*

Example for the monthly range

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=mo15&fields=kWh_Tot*

Click to try


Example for range

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=range&fields=kWh_Tot*

Click to try


URL Parameters

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

Summary Number of Summaries

Number of Summaries

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=20&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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:

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

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

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


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

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

Click to try


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

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

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

Click to try


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

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

Click to try


URL Parameters

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

Summary Offset & Timelimit

Offset

Offset

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*"
# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&fields=kWh_Tot*~RMS_Volts_Ln_1*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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.

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

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

URL Parameter

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

Timelimit

Timelimit

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
require 'pp'
pp apiObject

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONObject apiObject = EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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.


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=TIMELIMIT&fields=kWh_Tot*~RMS_Volts_Ln_1*

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


URL Parameter

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

Summary Time Zones

Time Zones

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

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call

# This just displays the object but you can use what ever
# code you would like to work with the object here
import pprint
pprint.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=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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:

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

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

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


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

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

Click to try


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

Click for Time Zone Information


URL Parameters

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

Summary Start Date & End Date

Start Date & End Date

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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
require 'pp'
pp apiObject

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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
import pprint
pprint.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=html&report=hr&limit=25&offset=0&tz=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
function callApi ($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 Modules
use LWP::Simple;
use JSON;
use Data::Dumper;

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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 apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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 here
       document.getElementById("result").innerHTML = "<pre>"+JSON.stringify(apiObject, null, 4)+"</pre>";
       });

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&report=hr&limit=25&offset=0&tz=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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=America~Los_Angeles&start_date=YYYYMMDDhhmm&end_date=YYYYMMDDhhmm&fields=kWh_Tot*

Date Parameters

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

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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=hr&limit=25&offset=0&tz=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*

Click the link below to see an example.

Click to try


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

Example of range for the report parameter

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=range&tz=America~Los_Angeles&start_date=201512010900&end_date=201512020800&fields=kWh_Tot*

Click to try

URL Parameters

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

Summary Hours

Hours

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=kWh_Tot*"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=kWh_Tot*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&report=15&hours=1300-1530&fields=kWh_Tot*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=kWh_Tot*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));       

    return 0;
}

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.

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&hours=hhmm-hhmm&fields=kWh_Tot*

Time Parameters

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

Click the link below to see an example.

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&hours=1300-1530&fields=kWh_Tot*

Click to try


URL Parameters

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

Summary Fields

Fields

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

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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
import pprint
pprint.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=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

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

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

  // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

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

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

};

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

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

// NodeJS requires the "request" module to access the API
// Install by running "npm install request" from the shell prompt

// Load "request" module
var request = 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 call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&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 here
        console.log(JSON.stringify(apiObject, null, 4));
});

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback){

        var options = { method: 'GET'
                        , uri: apiRequest
                        , timeout: 1000*15
                        , strictSSL: false
                        , rejectUnhauthorized : false
                      };

        request(options, function (error, response, body) {
                if(error){
                        console.log(error);
                        throw error;
                }else{
                     var jsonObject = 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
struct string {
    char *data;
    size_t len;
};

void init_string(struct string *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_t curlData(void *data, size_t size, size_t nmemb, struct string *response)
{
    size_t new_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;

    return size*nmemb;
}
// End required Curl coding

// This function accesses the api URL and converts
// the contents to a usable JSON-C object and returns it
struct json_object* callAPI(const char * url){
    CURL *curl;
    CURLcode res;
    json_object * jsonObject;
    curl = curl_easy_init();
    if(curl) {
        struct string response;
        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();
    return jsonObject;
}

int main(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=html&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

    int arraylen = json_object_array_length(apiObject); /*Getting the length of the array*/
    json_object * summary;
    int i;
    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));     

    return 0;
}

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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=FIELDS


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

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try


The example below is the same as the one above, except is shows the address with a comma after the fields name instead of the tilde separator.

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*,RMS_Volts_Ln_1*

Appending the asterisk ( * ) at the end of the field name will show all matching field values associated with the provided fields name.

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot*~RMS_Volts_Ln_1*

Click to try

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

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


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

Example: kWh_Tot_DeltaMax

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_DeltaMax,kWh_Tot_Max

Click to try


Example: kWh_Tot_Max

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_Max

Click to try


If you want to include more than one fields value but not all associated values for a given fields, you would add that value to the address like you were calling another fields name.

Example: kWh_Tot_DeltaMax~kWh_Tot_Max

http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=15&limit=10&offset=0&timelimit=5&timezone=America~Los_Angeles&fields=kWh_Tot_DeltaMax~kWh_Tot_Max

Click to try


The data fields that you are interested in are not limited to these two in the examples above. You can add just one field or include as many fields as your needs require.

URL Parameters

The fields below are the Summary fields for v3 and v4 meters

FieldDescription
kWh_Tot*Total kWh
Show sub-fields
kWh_Tariff_1* kWh for Tariff 1
Show sub-fields
kWh_Tariff_2* kWh for Tariff 2
Show sub-fields
kWh_Tariff_3* kWh for Tariff 1
Show sub-fields
kWh_Tariff_4* kWh for Tariff 1
Show sub-fields
Rev_kWh_Tot* Total Reverse kWh
Show sub-fields
Rev_kWh_Tariff_1* Reverse kWh for Tariff 1
Show sub-fields
Rev_kWh_Tariff_2* Reverse kWh for Tariff 2
Show sub-fields
Rev_kWh_Tariff_3* Reverse kWh for Tariff 3
Show sub-fields
Rev_kWh_Tariff_4* Reverse kWh for Tariff 4
Show sub-fields

RMS_Volts_Ln_1* Volts on Ln 1
Show sub-fields
RMS_Volts_Ln_2* Volts on line 2
Show sub-fields
RMS_Volts_Ln_3* Volts on line 3
Show sub-fields
Amps_Ln_1* Amps on line 1
Show sub-fields
Amps_Ln_2* Amps on line 2
Show sub-fields
Amps_Ln_3* Amps on line 3
Show sub-fields
RMS Watts_Ln_1* Watts on line 1
Show sub-fields
RMS Watts_Ln_2* Watts on line 2
Show sub-fields
RMS Watts_Ln_3* Watts on line 3
Show sub-fields
RMS Watts_Tot* Total Watts all line
Show sub-fields
Power_Factor_Ln_1* Power Factor on line 1
Show sub-fields
Power_Factor_Ln_2* Power Factor on line 2
Show sub-fields
Power_Factor_Ln_3* Power Factor on line 3
Show sub-fields
RMS_Watts_Max_Demand* Max Demand
Show sub-fields
CT_Ratio* CT Ratio
Show sub-fields

The fields below are additional Summary fields only for v4 meters

Pulse_Cnt_1* Pulse Count on Input 1
Show sub-fields
Pulse_Cnt_2* Pulse Count on Input 2
Show sub-fields
Pulse_Cnt_3* Pulse Count on Input 3
Show sub-fields
Pulse_Ratio_1* Pulse Input Ratio on input 1
Show sub-fields
Pulse_Ratio_2* Pulse Input Ratio on input 2
Show sub-fields
Pulse_Ratio_3* Pulse Input Ratio on input 3
Show sub-fields
Reactive_Energy_Tot* Total kVARh
Show sub-fields
kWh_Rst* Resettable kWh
Show sub-fields
Rev_kWh_Rst* Resettable Reverse kWh
Show sub-fields
Reactive_Pwr_Ln_1* VAR on line 1
Show sub-fields
Reactive_Pwr_Ln_2* VAR on line 2
Show sub-fields
Reactive_Pwr_Ln_3* VAR on line 3
Show sub-fields
Reactive_Pwr_Tot* Total VAR
Show sub-fields
Line_Freq* Frequency (Hz)
Show sub-fields
kWh_Ln_1* Total kWh on line 1
Show sub-fields
kWh_Ln_2* Total kWh on line 2
Show sub-fields
kWh_Ln_3* Total kWh on line 3
Show sub-fields
Rev_kWh_Ln_1* Reverse kWh on line 1
Show sub-fields
Rev_kWh_Ln_2* Reverse kWh on line 2
Show sub-fields
Rev_kWh_Ln_3* Reverse kWh on line 3
Show sub-fields
Max_Demand_Rst* Max Demand auto reset status
OFF = 0
Monthly = 1
Weekly = 2
Daily = 3
Hourly = 4
Show sub-fields
Net_Calc_Watts_Ln_1* Net Watts on line 1
Show sub-fields
Net_Calc_Watts_Ln_2* Net Watts on line 2
Show sub-fields
Net_Calc_Watts_Ln_3* Net Watts on line 3
Show sub-fields
Net_Calc_Watts_Tot* Total Net Watts
Show sub-fields
CF_Ratio* Settable Pulse Output Ratio
Show sub-fields

Summary Normalize

Normalize

curl -s
"http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1"

# Load required modules
require '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 call
def callApi(apiRequest)
    json = Net::HTTP.get('summary.ekmmetering.com',apiRequest)
    return JSON.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.com
apiObject = callApi('/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1')

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

# Required Python Modules
import urllib2
import json

# This function accesses the apiRequest URL and converts
# the contents to a usable Python object and returns it
def callApi ( apiRequest ):
        response = urllib2.urlopen(apiRequest)
        response = response.read()
        jsonObject = json.loads(response)
        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 call
apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1")

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

// 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=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1');

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

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

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

}
?>

# Install JSON module
# for example on centos 6.5
# yum install cpan
# cpan JSON


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

# This function accesses the apiRequest URL and converts
# the contents to a usable Perl object and returns it
sub 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 call
my $apiObject = callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1");

# This just displays the object but you can use what ever
# code you would like to work with the object here
print Dumper($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 classes
import java.net.*;
import java.io.*;
import org.json.*;

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

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

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

        StringBuilder response = new StringBuilder();
        String inputLine;

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

        in.close();

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

    public static void main(String[] args) throws Exception {
        /*
         Call callApi to create a usable
         object named apiObject from the API request URL.
         Put the API request URL in the call
         */
        JSONArray apiObject = EKM.callApi("http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1");

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

    // This just outputs the whole apiObject
        System.out.println(apiObject.toString(4));
    }
}

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

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

// Call the callApi function to create a usable
// object named apiObject from the API request URL.
// Put the API request URL in the call
callApi('http://summary.ekmmetering.com/summary?meters=10068&key=MTAxMDoyMDIw&format=html&report=wk&limit=12&timezone=America~Los_Angeles&fields=kWh_Tot*&normalize=1',function(apiObject){

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

};

// This code accesses the apiRequest URL and converts
// the contents to a usable JSON object named apiObject
function callApi(apiRequest,callback) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (xhttp.readyState == 4 && xhttp.status