Hey,
I am working with an Arduino Mega 2560 and want to make an HTTP request about a CO2 signal. The problem is that the homepage (API Reference) needs an API key (header). I have the key but I have no idea how to use it with the HTTP request. Anyone who knows how to solve it? Afterwards, i want to receive the json data and parse it. Thanks for help!
void APIabfrage() {
HttpClient client;
// Make a HTTP request:
client.get("https://api.co2signal.com/v1/latest?countryCode=DE");
// headers={"auth-token":"xy"}).json;
// if there are incoming bytes available
// from the server, read them and print them:
while (client.available()) {
char c = client.read();
Serial2.print(c);
//static const char* queries = { "carbonIntensity", "price"};
// StreamJsonReader jsonreader(queries, 2); // 2 queries
// while(char c = read()){
// jsonreader.process_char(c);
//}
}