Hello guys,
I'm new to oem project and I really like it.
I installed emoncms to an altervista server, I can manage all the interface correctly.
Now I want to send data with post http request from my watto device, where the radio part is wifi made with flyport device.
I already used with success the http request from flyport device with other service like xively and nimbits, all is working correctly there.
I have a problem with emoncms. I send the following request:
POST /emoncms/input/post.json? HTTP/1.1
HOST: wattodemo.altervista.org/
Content-Type: application/x-www-form-urlencoded
Content-Length: 76
/emoncms/input/post.json?apikey=2dd2XXXXXXXXXXXXXXXXXcbf&json={Power:32,Current:2}
and the server answer is
HTTP/1.1 400 Bad Request
Date: Tue, 03 Jun 2014 15:40:52 GMT
Server: Apache
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
I tryed also with server installed on emoncms.org, where I received a 200 ok answer but the data are not updated.
I can correctly send request from http rest client on chrome with the following:
http://wattodemo.altervista.org/emoncms/input/post.json?json={Power:31,Current:1}&apikey=2dd2xxxxxxxxxxxxxxxx4cbf
Can you suggest me what is wrong with my request?
Thanks
Dario
Re: http post request to altervista server
Ok, there was an error in the domain name for the TC/IP connection. It should be wattodemo.altervista.org instead of altervista.org I used before.
Now the request is:
POST /emoncms/input/post.json? HTTP/1.1
Host: wattodemo.altervista.org
Content-Type: application/x-www-form-urlencoded
Content-Length: 51
json={32,2}&apikey=2ddxxxxxxxxxxxxxxxxxxxcbf
the altervista server answer is ok
HTTP/1.1 200 OK
Date: Thu, 05 Jun 2014 11:27:33 GMT
Server: Apache
But the data are not updated, like with emoncms.org server
Any suggestion?
Re: http post request to altervista server
Solved, thanks