URI not acceptable

Hello,

I Installed emoncms on a BananaPiPro with Armbian installed.
Installation works finde, I created an account…everything’s fine.
Then, I wan’t to imprt data via the api.
When I enter the URL in a browser, I get:
URI not acceptable. No controller ‘api’. (post/)

When I use the same URL (with a different apiky) on emoncms.org everything’s working,
So I thing the URL is correct.

Any hints about this?

Regards

Daniel

Any Ideas how to find the cause of this? Emoncms seems not to log anything…

Daniel - Can you post the URI for what worked (on emoncms.org) and what did not work?

Do not post your API Key. Change your API Key to something like this: &apikey=APIKEY

http://www.emoncms.org/api/post?apikey=apikey&time:2017-12-12T15:28:50.658898&json={‘flow_rate’:‘1011.0’}&node=3

This URI worken when I opened it in a browser.

http://my_emoncms/emoncms/api/post?apikey=apikey&time:2017-12-12T15:28:50.658898&json={‘flow_rate’:‘1011.0’}&node=3

When I test this URL, I get “URI not acceptable. No controller ‘api’. (post/)” and now data is visible at the emoncms gui.

Regards

Daniel

Daniel,

I cannot answer why the Emoncms - site home works and the http://my_emoncms/emoncms/api/post did not. The /api/post is not something I have seen before.

This works for me for the local emoncms:

http://my_emoncms/emoncms/input/post?node=3&json={'flow_rate':'1011.0'}&time=1513094950&apikey=APIKEY

Also for the &time= portion I’ve only seen the time represented in epoch seconds (for the Input API)

you should be able to see examples at:

http://my_emoncms/emoncms/input/api

or at:

https://emoncms.org/site/api#input

 

EDIT: I just tried &time: with the ISO 8601 format (&time:2017-12-12T16:54:57) and it did work! Cool!

1 Like

https://emoncms.org/api is intended for the api documentation which is unique to emoncms.org, it doesn’t exist on local emoncms. You should be using Emoncms - user login as per the examples given on the https://emoncms.org/api#input page.

The reason you are getting to the “input” api via a “api” api url is because of this little redirection (correction?) in the index.php on emoncms.org but it is not present on the main emoncms repo.

The wrong url…thats it. Thanks a lot.
Works like a charm now :slight_smile:

Useful to know. Just spent a while converting to milliseconds…

EDIT - I tried this and the data posting is reported as successful (the http response) but the feed is flagged as inactive.

Note also, Emoncms expects seconds (10 digits) not milliseconds IME.

EDIT 2 - It may work :smile:. I’m using the nod-red node and the Javascript does a conversion which may be the problem. Does the input side check on a valid time before sending the success:true response?

I don’t believe it does. Hopefully someone else can confirm.

I have discovered that if you use a non-numeric date/time in the URI, that is not ‘now’, then although the API responds with OK, the feed is marked as n/a.

Date/time in seconds, that is not ‘now’, is OK.

Issue #777