Issues using AT commands to read a channel field

IOT4ALL on 18 Mar 2022
Latest activity Reply by Christopher Stapels on 21 Mar 2022

Hello!

I`ve got problems with reading last input of a channel field using AT commands, here follows the sketch I'm currently using:

/* String tx_data_r = "GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1"; */

String tx_data_r = "GET https://api.thingspeak.com/channels/";
tx_data_r += "CHANNEL";                                                                         
tx_data_r += "/";
tx_data_r += "fields";                                                                    
tx_data_r += "/4/";                                                                            
tx_data_r += "last.txt?api_key=";
tx_data_r += "API_READ_KEY";                                                                 
tx_data_r += "&results=1";                                                                   
tx_data_r += "\r\n";
Serial.print("AT+CIPSEND=");                                                                                                                                              
delay(1000);
Serial.println(tx_data_r.length());                                                                                                                                    
delay(1000);
Serial.println(tx_data_r);
delay(1000);
 This piece of code doesn`t return a valid response, however if I copy/paste
 https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1"
 using a browser I get the right data.
 One more thing, if instead of using a microcontroller I use an USB serial PC interface program  directly connected to 
 my RF module, with                                                                      
 GET https://api.thingspeak.com/channels/CHANNEL/fields/4/last.txt?api_key=API_READ_KEY&results=1
 along with other commands I get the right data too!
 Can anybody tell me what's going on?
 There are no problems with any read related commands.
 If a working sketch is available it will be most welcome!
 Tks in advance for any help! 
Christopher Stapels
Christopher Stapels on 21 Mar 2022

I've seen some advice not to include the https:\\, or to connect to the server separately from sending the command to read data to the server as in this post . M y advice is generally not to use the AT command set. What is your hardware and why do you need to use AT commands?

IOT4ALL
IOT4ALL on 18 Mar 2022

Sorry: There are no problems with any write related commands.