Hi All
I am trying to use HTTP client to recieve a JSON string from a stocks web API but can not get it to work. I have tried troubleshooting and looking at all of the existing http client advice on the forum, but still have not gotten it to work, and continually receive no data from the server.
Here is my code, help would be appreciated:
#include <HttpClient.h>
HttpClient http;
http_header_t headers[] = {
{ "Accept" , "*/*"},
{ "User-agent", "www.alphavantage.co HttpClient"},
{ NULL, NULL }
};
http_request_t request;
http_response_t response;
// Set up the gauge motors
void setup()
{
Serial.begin(9600);
request.hostname = "www.alphavantage.co";
request.port = 80;
char conditionsRequestPath[100];
sprintf(conditionsRequestPath, "/query?function=TIME_SERIES_INTRADAY&symbol=TCEHY&interval=5min&apikey=DOXC7CQZ904B63J2");
request.path = conditionsRequestPath;
}
void loop()
{
Serial.println("response: "+response.body);
}