How to send HTTP request


I’m facing problem in sending HTTP request. I’m trying to send to the ubidots server by creating my own variable but while sending every time getting response as “400 BAD Request”
for your reference Here I’m placing the http post request for which I want to create a variable.

<0x1b>S0 curl -i–header “Accept: application/json; indent=4” --header “Content-Type: application/json”–header “X-Auth-Token: ZFJSStMA07BL87bNQtG8IXSPw06y330OIw9ZgUz6xSM3EVxJmdZiHCZ605Dh”-X POST -d ‘{“value”:24}’ … e13/values<0x1b>E

The response is as follows

HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 04 Jan 2016 10:43:16 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

400 Bad Request

400 Bad Request


Could anyone help me how to send the http request successfully.

Thank you


WizFi210 is based on a TCP layer(as known as Transport layer in TCP/IP layer) connection device. so, WizFi210 is the object in charge of performing the actual connection to the other “TCP layer” device, as well as writing requests and reading responses.

But, “CURL” that you used command is a command line tool using URL syntax(Application Layer in TCP/IP layer)

So, You have to change the request CURL syntax to TCP stream syntax like below.

POST /api/v1.6/variables/5689f91b76254265137e8e13/values HTTP/1.1
Content-Type: application/json
Content-Length: 13
X-Auth-Token: ZFJSStMA07BL87bNQtG8IXSPw06y330OIw9ZgUz6xSM3EVxJmdZiHCZ605Dh

{“value”: 24}


Please copy below text and send to server

<0x1b>S0POST /api/v1.6/variables/5689f91b76254265137e8e13/values HTTP/1.1<0x0d><0x0a>Content-Type: application/json<0x0d><0x0a>Content-Length: 13<0x0d><0x0a>X-Auth-Token: ZFJSStMA07BL87bNQtG8IXSPw06y330OIw9ZgUz6xSM3EVxJmdZiHCZ605Dh<0x0d><0x0a><0x0d><0x0a><0x0d><0x0a>{"value": 24}<0x0d><0x0a><0x0d><0x0a><0x1b>E
  • <0x0d>,<0x0a> are hexadecimal(CR, LF)