posting data to emoncms

does emoncms accept http POST or does it only work with GET?

currently i am uploading data to emoncms with http GET like this:

https://hostname/api/post?apikey=TOKEN&json={var1:200.2,var2:200,var3:100}

i would prefer to do http POST like this:

https://hostname/api/post

then put the json data, including the apikey, into the actual http POST payload.  i anticipate having some rather large chunks of json data (feeds from more than 50 circuits/sensors for each sample) and i do not want to run into URL length issues.

is this supported by emoncms?

where is the API definition for how to interact with the emoncms server?

 

TrystanLea's picture

Re: posting data to emoncms

 Hello powermeister, although emoncms does not currently do this, it would be a relatively easy fix to make ti happen, if you go to Controllers/api_controller and switch the $_GET lines to $_POST. that should do it.

A beginning on the api description can be found here: http://openenergymonitor.org/emon/node/192

powermeister's picture

Re: posting data to emoncms

thanks for that.

in the api page, could you add a column that indicates when each api element (each row in the api tables) was implemented?  that way we would have a reference for not only what is actually implemented, but also when each feature was implemented (so we'll have a better idea of when to upgrade) and a map of what the unimplemented features/calls will look like (so we can have discussions about them and possibly go off and implement them).

for example, instead of just these columns:

actions | external api | access | internal api

have these columns:

actions | access | external api | internal api | when implemented

the 'when implemented' column would have the release number (or even the git hashcode) when the row became available.

TrystanLea's picture

Re: posting data to emoncms

 Thanks for all the suggestions, I will add these columns in

maha's picture

Re: posting data to emoncms

Hello 
I have a problem , is that the Interfacing with the emoncms models and database via the emoncms API  does not work .

the method client.println("emoncms/api/post?apikey=YOURAPIKEY&json={power:200.2}"); 

​don't have any result .

what should I do ?
 

TrystanLea's picture

Re: posting data to emoncms

Hello maha

Are you using client.println() along with the reset of the Arduino Ethernet sketch? 

Have you tried accessing the API from your internet browser?

 

 

abramidgeo's picture

Re: posting data to emoncms

Hello,

I would like to ask:

1) In order to send data to Emoncms I have to open the browser and use a command like e.g http://localhost/emoncms/input/post.json?node=1&csv=100,200,300???

Assuming I use Java to get values from my analyzers. The only way to send data is to call Browser from java with link "http://localhost/emoncms/input/post.json?node=1&csv=100,200,300" and then close the browser using java, or maybe I can import the data using an other method.

2)If I want to use The Led in dashboard (green for 1 and red for 0) for a variable, do I need to create a Feed for this variable? I don;t want to have a log but only show the real-time status (when i say real-time  I mean the last value (0 or 1) that was sent to Emoncms).

3)In order to create a feed and log Day Energy I get from my analyzers Power Values and Total Energy Values.

The Total Energy Value is an incremental  variable that never goes to zero.

Can I use only the Power Value with the Power to kWh/d process so that the EmonCMS can calculate the daily energy consumption/production?

I should use the Total Energy Value with the Wh increment to khw/d process or with kWh to kWh/d process in order to get daily energy consumption/production if Power Value alone is not enough?

 

Thank you

George

 

Robert Wall's picture

Re: posting data to emoncms

Your multiple copies of this post have been deleted. Please do not post again if your submission does not appear, you should see a message explaining that it is held for moderation.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.