API: Input process actions not working

Hello!

 

I try to set up process over the API.

Example: 

http://192.168.0.202/emoncms/input/process/add.json?inputid=1&processid=1&arg=-1&newfeedname=power

 

I always get "false"

 

May I made a error or how can I use it?

 

Thank you!

unique24's picture

Re: API: Input process actions not working

Ok, I found the commands for "*" and "+":

http://192.168.0.202/emoncms/input/process/add.json?inputid=17&processid...

 

So have someone a complete list of the arg's?

Because processid 1 is for feed and it does not work to generate a new one.

I can link a existing feed, but need to create new one.

 

Thank you!

ukmoose's picture

Re: API: Input process actions not working

Have you tried adding your Read&Write API key?

 

unique24's picture

Re: API: Input process actions not working

Hello!

 

Well, I can add now process and feeds, but I dont know the arg.

To generate a new process and Feed I have to add The correct arguments.

Is there a list or more examles?

 

THank you!

ukmoose's picture

Re: API: Input process actions not working

The API documentation is available from the API page in emoncms ( Input API help - top right)  http://emoncms.org/input/api

 

unique24's picture

Re: API: Input process actions not working

Hello!

 

Yes, this link I know.

But for:

Add an input process

There are a lot off different processes.

 

pb66's picture

Re: API: Input process actions not working

http://emoncms.org/site/docs/inputprocessing is specific to the input processes, this and other helpful pages are all available from the main emoncms.org page http://emoncms.org/site/home

unique24's picture

Re: API: Input process actions not working

Hello!

 

Ok, thank you. This helps, but it working not for me.

I found that the "arg" has to be the ID and not the name!

This is working:

http://192.168.0.202/emoncms/input/process/add.json?inputid=19&processid=1&arg=15

But I have also to add a new feed:

http://192.168.0.202/emoncms/feed/create.json?name=api_demo&type=1

With this a new feed is created, but need:

datatype: REALTIME

Engine: PHPFIWA

 

What means type in the url? Trying PHPFIWA and some Integer values. But always create:

Datatype:empty

Engine: MYSQL

 

Thank you!

unique24's picture

Re: API: Input process actions not working

I also tryied:

http://192.168.0.202/emoncms/feed/set.json?id=18&fields={'engine':'0'}

or:

http://192.168.0.202/emoncms/feed/create.json?name=api_demo_1&type=0&fields={%27engine%27:%270%27}

 

But is not working.

Has someone a complete sample to create feeds and process via API?

 

Thank you!

unique24's picture

Re: API: Input process actions not working

Edit:

 

Ok, I found it. I search the files at the local webserver.

http://192.168.0.202/emoncms/feed/create.json?name=api_demo_9&datatype=1...

I get:

Notice: Trying to get property of non-object in /var/www/emoncms/Modules/feed/feed_model.php on line 104
{"success":true,"feedid":30,"result":true}

 

Seems it working, but does someone know, what the notice mean?

 

Thank you!

 

pb66's picture

Re: API: Input process actions not working

 

If you open emoncms.org on an input page and open your browsers developer tools to the networks page. You can then see the urls that are produced whilst creating a feed on the webpage, from this you can emulate the urls you need.

I just tried it and got this url, 

http://emoncms.org/feed/create.json?name=api_demo_1&datatype=1&engine=5&options={"interval":"10"}

changed the "name" and pasted it into browser address bar and set up an identical feed, the browser returned

{"success":true,"feedid":40180,"result":true}

using this method you should be able to compile a list of editable/eusable urls.

 

The message is a result of not specifying a time interval, if you add

&options={"interval":"10"}

to your url it will work without the message. (10 is default for 10 secs - change as required)

Paul

unique24's picture

Re: API: Input process actions not working

Hello!

 

Great Tipp. Thank You very much!

s4k-IO's picture

Re: API: Input process actions not working

thx a lot!

had the same issues here!

s4k-IO's picture

Re: API: Input process actions not working

thx also from here! 

does anybody know how to add a wh Accumulator to an input?

also i'm trying to figure out how to set the tag attribute of the new feed.

 

Comment viewing options

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