About the input api.. Does it accept http post?

I thought someone would have a quick answer for this but it seems not … so i dug in the sources… The answer is YES it supports http post but it is not documented for some reason on the input api page and it doesn’t accept every parameter in the post data.

what i saw in the sources is that you can specify
http://192.168.0.101:8083/emoncmsnew/input/post.json?node=1&data={sensor1:200,sensor2:400,sensor3:4.5}
which is exacltly the same as
http://192.168.0.101:8083/emoncmsnew/input/post.json?node=1&json={sensor1:200,sensor2:400,sensor3:4.5}
but the important part is that the data value is also requested using $_POST it’s the only parameter in this case that can be “posted” (if you don’t include the apikey parameter as this is mentioned it can be posted but i did not test it)

see these lines here emoncms/input_controller.php at master · emoncms/emoncms · GitHub

if you see that code you’ll notice that this works also:
http://192.168.0.101:8083/emoncmsnew/input/post.json?node=1&csv={sensor1:200,sensor2:400,sensor3:4.5}

so i did a curl test with http post like so :

curl --data "data={sensor1:200,sensor2:400,sensor3:4.5}" "http://192.168.0.101:8083/emoncmsnew/input/post.json?apikey=XXXXXXXXX&node=24"

and this worked !

Now the BIG Question why isn’t this documented on Emoncms - site api ??? Especially the data parameter that can be used in http post

the second question will the http post using the data parameter keep functioning in the future, the reason i’m asking is because it isn’t documented (or at least i could not see it). Is it perhaps forgotten to update the documentation about this ?

I want to use http post + that data parameter but i need to be sure it won’t be removed all of a sudden … perhaps the input api documentation needs to be updated to include the part about the data parameter especially that you can http post using it ? (since all examples on the input api page using the links are actually http GET and not http POST)

it’s also weird on the input api page to mention the apikey can be http posted but nothing else about the data parameter that can be used to http post, actually the api key is the only mention of being able to http post …

edit: just tested against emoncms.org and it works there also