PIC to Mbed errors

Dependencies:   mbed

ubidots.c

Committer:
dan_cuspi
Date:
2017-09-01
Revision:
0:b329a09583fb

File content as of revision 0:b329a09583fb:

#include "ubidots.h"

uint8_t buffer[256];
    
/*const char* ubidotsPOST( const char* token,  const char* variable_id, float value){
    uint8_t  httpBody[SIZE_HTTP_BODY];
    memset(&buffer, 0,sizeof(buffer));
    sprintf(httpBody,"{\"value\":%2.2f}", value);
    
    sprintf(buffer, "POST /api/v1.6/variables/%s/values HTTP/1.1\r\n", variable_id);
    sprintf(buffer, "%sHost: things.ubidots.com\r\n",buffer);
    sprintf(buffer, "%sContent-Type: application/json\r\n", buffer);
    sprintf(buffer, "%sX-Auth-Token: %s\r\n", buffer, token);
    sprintf(buffer, "%sContent-Length: %i\r\n\r\n%s", buffer, strlen(httpBody), httpBody);
    
    return (uint8_t*)buffer;
}*/
uint8_t* ubidotsGET(const char* token, const char* variable_id )
{
    memset(&buffer, 0,sizeof(buffer));
    sprintf(buffer,"http://www.things.com/variables/%*s/?token=%*s",sizeof(variable_id),variable_id,sizeof(token),token);
    return (uint8_t*)buffer;
}