EMONCMS Key and Name update via the Input API

I have tried (with success) to get EMONCMS to log using both a csv input as well as a json input. 

Using a CSV input the "Key" is automatically given numbers depending on how many inputs values are sent. 

When using the JSON input the "Key" and "Value" are passed. 

But is there any way of passing the Input "Name" as well instead of having to manually update the Inputs via EMONCMS?

pb66's picture

Re: EMONCMS Key and Name update via the Input API

Have you looked at the input api?

http://emoncms.org/input/view

When posting via json the "key" can be a given "name" rather than a input number.

Rather confusingly the field called key in the inputs page is actually the "name"field, to which it gets assigned a "numerical name" ie a number if one isn't defined.

The field referred to as name in the emoncms inputs page is actually a "description" field to which we tend to use to identify(name) the numeric key by entering a descriptive name.

So to answer what I think you are asking, no you cannot send an Input description (name) but you can send a key via json which can be either a "name" or a number.

Paul

bruce_miranda's picture

Re: EMONCMS Key and Name update via the Input API

Probably should be an enhancement request for a future emoncms build.
quite often you know the key and name only when setting up the input via the code, so when you go back to add names to emoncms, you could be wondering which key corresponds to which name.

TrystanLea's picture

Re: EMONCMS Key and Name update via the Input API

You may be interested in taking a look at the new nodes module for emoncms. Its almost at the release stage. The HTTP API is much better than the input module. To test it copy the nodes folder from here:

https://github.com/emoncms/development/tree/master/Modules

into your emoncms Modules folder and then run Admin > db check and update

Then take a look at the API documentation page included as part of the module UI, here's a quick example:

request type: POST

URL                             post body:

/nodes/10/rx/values    100,200,300
/nodes/10/rx/names    power1,power2,power3
/nodes/10/rx/units    W,W,W

Comment viewing options

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