MATLAB ANALYSIS run Successfully on ThingSpeak, BUT always generates Server Error 500, so doesn't send email
1 回表示 (過去 30 日間)
古いコメントを表示
The error is:
"Failed to send alert: The server returned the status 500 with message "Internal Server Error" in response to the request to URL https://api.thingspeak.com/alerts/send."
The message says MATLAB Analysis ran successfully, so the code is good, but never sends the email because of the server error.
Simple code from examples:
% Catch errors so the MATLAB code does not disable a TimeControl if it fails
try
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
catch someException
fprintf("Failed to send alert: %s\n", someException.message);
end
Where to go from here?
0 件のコメント
回答 (1 件)
Vinod
2024 年 9 月 30 日
Here's the code I used to test an alert email.
% Send ThingSpeak Alert
alertURL = "https://api.thingspeak.com/alerts/send";
apiKey = '***INSERT_YOUR_ALERT_API_KEY***';
options = weboptions("HeaderFields", ["ThingSpeak-Alerts-API-Key", apiKey]);
alertBody = sprintf("Testing ThingSpeak Alert.");
alertSubject = sprintf("Alerts are working");
webwrite(alertURL, "body", alertBody, "subject", alertSubject, options);
Can you modify and confirm it works for you?
0 件のコメント
コミュニティ
その他の回答 ThingSpeak コミュニティ
参考
カテゴリ
Help Center および File Exchange で REST API についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!