Unable to write data to ThingSpeak , HTTP error 400
Ältere Kommentare anzeigen
Hello,
I am trying to transfer data by using program "Typical Write Example" running on ESP8266 NodeMCU. I didn't change he program , only added my Network name, network password, channel number and APIWriteKey. The Program is running on ESP8266 or ESP32. In both cases the response is always "400".
Don't have more detailed information.
Any idea on the cause ? Router problem , Arduino IDE 1.8.10 or ?
Any comment is appreciated.
Kind regards
Antworten (3)
Vinod
am 6 Jan. 2020
0 Stimmen
Hello Otto,
Can you start from one of the examples in the library here: https://github.com/mathworks/thingspeak-arduino
Are you getting 400 status codes for those examples?
-Vinod
1 Kommentar
Otto Meier
am 6 Jan. 2020
Christopher Stapels
am 6 Jan. 2020
0 Stimmen
Can you try to update your channel from a web browser? Use the format
https://api.thingspeak.com/update?api_key=xxxxxxxxxxxxxxxx&field1=1230 but change the api key to match.
Does that work?
9 Kommentare
Otto Meier
am 6 Jan. 2020
Christopher Stapels
am 6 Jan. 2020
Was there a response in the browser when you entered the command?
Otto Meier
am 6 Jan. 2020
Otto Meier
am 6 Jan. 2020
Christopher Stapels
am 6 Jan. 2020
That might mean you have the incorrect API key. Can you check to be sure you are using the Write API key from the channel view and not your user API key, or could you have possibly made a typo?
Otto Meier
am 6 Jan. 2020
Otto Meier
am 6 Jan. 2020
Otto Meier
am 6 Jan. 2020
Christopher Stapels
am 8 Jan. 2020
Glad you got it! Thanks for letting us know.
Nazmi Rosly
am 16 Aug. 2021
Bearbeitet: Christopher Stapels
am 17 Aug. 2021
0 Stimmen
Hi. Im trying to send data from matlab which is the data from serial monitor from arduino. It is fine until 9th of data and then it stopped and says :
Error using Untitled (line 27)
'Values' must have a maximum of 9 elements, including the timestamp.
My coding is:
clear all
s = serial('com4');
fopen(s);
i = 1;
while(1)
data(i)= str2double(fscanf(s));
plot(data);
title('Temperature Monitoring')
xlabel('Time')
ylabel('Temperature')
pause(30);
i=i+1;
%thingSpeakWrite(1463959,data,'WriteKey','xxxxxxxxxxxxxxxx')
% Generate timestamps for the data
%tStamps = datetime('now')-minutes(9):minutes(1):datetime('now');
channelID = 1463959; % Change to your Channel ID
writeKey = 'xxxxxxxxxxxxxxxx'; % Change to your Write API Key
% Write 10 values to each field of your channel along with timestamps
tStamp = datetime('now')
thingSpeakWrite(1463959,data,'WriteKey','xxxxxxxxxxxxxxxx','TimeStamp',tStamp)
end
Communitys
Weitere Antworten in ThingSpeak Community
Kategorien
Mehr zu Read Data from Channel finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!