Problems with POST Message


I'm trying to connect with a Server and I have established correctly the connection using:

clientRest.setHeader("Content-Type: xxxxxxx");"/token", "xxxxxxxxxx", &response);

My problem is with the size of response because when I try to parse de response, I can see that the variable response (String) doesn't have the full information, and finish before the end of the server message then, the I do the parse...I have problems:

JsonObject& root = jsonBuffer.parseObject(response);
T1 = root["t1"];
T2 = root["t2"];

I'm trying to declare the variable response how a global variable and I can see that now I have more informativo but not full information.

Any idea?

When I have compiled, the memory usage is:

El Sketch usa 22004 bytes (68%) del espacio de almacenamiento de programa. El máximo es 32256 bytes.
Las variables Globales usan 1144 bytes (55%) de la memoria dinámica, dejando 904 bytes para las variables locales. El máximo es 2048 bytes.

Any idea?

would it not make sense to share your code and (in particular) explain what libraries you are using?


Sorry, I'm using:

#include <SPI.h>
#include <MFRC522.h>
#include <Ethernet.h>
#include "RestClient.h"
#include "ArduinoJson.h"

I'm doing an access control based on NFC cards and I've to authenticate with a server to check the card. The part of the code where I have problems is:

DynamicJsonBuffer jsonBuffer(1000);

clientRest.setHeader("Content-Type: application/x-www-form-urlencoded");"xxxxx", "xxxxxxxxxx", &response);


JsonObject& root = jsonBuffer.parseObject(response);
accessToken = root["access_token"];
refreshToken = root["refresh_token"];

Serial.println(F("Imprimir access token:"));
Serial.println(F("Imprimir refresh token:"));

When I print the variable response I can see that it is not complete. Then, I think that the parser can not run properly. I try to add a "}" at the end of the response, but doesn't work, because I can see that I have the data for token and access token at the variable response.


Thank you very much.