Community
OpenEnergyMonitor

Community

Create Feed API not working

I am trying to create new feed remotely through API in my emoncms account, but it is showing "Invalid ID " and false result. Please suggest any solution ASAP.

Do you mean emoncms.org or a local install?

Yes Emoncms.org only. I tried the API, but it is not working
http://emoncms.org/feed/create.json?tag=emontx&name=Power3&datatype=1&engine=5&options={“interval”:10}&apikey=************************

This is the link I used. Can you suggest any solution?

You need @TrystanLea to help.

@TrystanLea can you please help regarding this query?

No need to ask a second time. :wink:

When Brian posted @TrystanLea, that generated a notification to Trystan.
(I posted it here as “code” so it wouldn’t generate yet another notification to Trystan.
Thats why it looks a bit different from the text in Brian’s post)

If you want to get someone’s attention, you can prefix their name with an @ sign,
and the system will notify them about the post(s).

Sorry for the delay @nupura, looks like there was an error in the documentation there, the following works:

https://emoncms.org/feed/create.json?tag=EmonTx&name=power1&datatype=1&engine=5&options={"interval":10}&unit=W

It needs the unit parameter.

Hello @TrystanLea
I tried the link you sent. But there is an issue with this link too.
It is creating new feed processes, but it is not linking these processes with respective inputs. So, I am not able to use it. Please suggest a solution.

You will not be able to use that example directly. You will need to change the tag and name parameters (and possibly others) to suit your local situation.

Hello @nupura, if you need to link feeds to inputs, its best to use the inputs page and input processing UI to do this, or are you trying to automate the process?

Hello @TrystanLea , yes I am trying to automate the process. Is there a way to do so?

@borpin I tried doing that. Still not working.

If you were using a self-hosted system I would suggest using the emoncms device module and writing your own device templates for automatic configuration. However as you are using emoncms.org this only applies to the standard set of templates that are available. The device module is accessible via the configuration cog on the inputs page (top-right):

As you need to write a script that runs from your computer, you will need to do everything via the HTTP api and so I would suggest using the browser > developer tools > network tool to work out what API calls you need to make. You can do this by manually creating inputs, input processes and feeds via the input processing UI and noting down the API calls made.

As an example:

  1. Start by creating a set of inputs:
    GET https://emoncms.org/input/post?node=emontx&fulljson={"power1":100,"power2":200,"power3":300}

  2. Get the input list so that you know the input ID’s that have been created:
    GET https://emoncms.org/input/list.json

  3. Create a feed:
    GET https://emoncms.org/feed/create.json?tag=emontx&name=power1&datatype=1&engine=5&options={“interval”:10}&unit=W
    This will return the feed id in the response.

  4. Add an input process:
    POST https://emoncms.org/input/process/set.json?inputid=INPUT_ID
    post body: processlist=process__log_to_feed:FEED_ID