Solved: API Interface to Emoncms v5

Hi, I have just upgraded to V5 of emoncms, and have a problem with the API interface.

With V4, I was making a call using http://localhost/emoncms/feed/get.json?id=1  This was returning the temperature and the timestamp in a json formatted string.

 

Am I right in thinking that I now need to make two calls - one for the temperature, and one for the timestamp of the form http://localhost/emoncms/feed/get.json?id=1&field="value" and http://localhost/emoncms/feed/get.json?id=1&field="time"  ?

 

Making two calls instead of one will slow my program down.  Is there any way I can get both values back with one call?

engeeaitch's picture

Re: Solved: API Interface to Emoncms v5

Hi - I'm struggling with this one - it looks like the API has changed significantly between V4 and V5.  Can anyone help with my request please?

engeeaitch's picture

Re: Solved: API Interface to Emoncms v5

OK - so my take on this is that it is not possible with the code as it stands.

However, I have modified the file feed_controller.php to include the following line immediately after line 45:

if ($route->action == "fullvalue") $result = $feed->get(get('id'));

This extends the API so that I can now make a call that looks like this:

http://localhost/emoncms/feed/fullvalue.json?id=1

This returns all of the values, including the time, and works for me. 

Comment viewing options

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