[un/loquer] ¿Cómo hacer un post a un API desde el ESP8266?

Miguel Vargas miguelito.vargasf en gmail.com
Sab Mar 26 00:07:33 UTC 2016


como era el asunto con hacer el transfer y papel fotosensible?.... uber
podria enviarnos info por este lado?... mil gracias....

hoy estuve en plan semana santa... pero sabado hay camello?

2016-03-25 17:09 GMT-05:00 brolin <brolin108 at gmail.com>:

> Hola,
>
> estuvimos trabajando con Uber en estos días pillando cómo se hace un post
> a un API. Lo estábamos intentando con ubidots.
>
> Este curl : curl -XPOST -H 'Content-Type: application/json;' -H
> 'X-Auth-Token: AUTH_TOKEN' -d '{"value": 23}'
> http://things.ubidots.com/api/v1.6/variables/ID_VARIABLE/values
>
> en arduino se escribe así:
>
>   String url = "http://things.ubidots.com/api/v1.6/variables/" ID_VARIABLE "/values";
>   http.begin(url);
>   http.addHeader("Content-Type", "application/json");
>   http.addHeader("X-Auth-Token", AUTH_TOKEN);
>   int content_length =0;
>   String payload = String("{ \"value\": " + String(millis()/1000) + "}");
>   //content_length = payload.length();
>   //http.addHeader("Content-Length ", String(content_length));
>   int httpCode = http.POST(payload);
>   if(httpCode > 0) {
>     String payload = http.getString();
>     Serial.println(payload);
>   }
>   else {
>     Serial.print("[HTTP] failed, error: ");Serial.println(http.errorToString(httpCode).c_str());
>   }
>   http.end();
>
> El código se subió acá https://github.com/unloquer/postUbidots/
>
> Por otro lado Uber diseñó unas tarjeticas para el ESP, un nodemcu local :D
> Hay que mandarlas a hacer a colcircuitos
>
>
> Saludos,
> -
> b
>
> _______________________________________________
> unloquer mailing list
> unloquer at lists.aktivix.org
> https://lists.aktivix.org/mailman/listinfo/unloquer
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.aktivix.org/pipermail/unloquer/attachments/20160325/bec9e3c3/attachment.html>


Más información sobre la lista de distribución unloquer