Thingspeak.com yelling "getJSON request failed!"
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Hello
I'm using site Thingspeak.com for storing data from my sensors.
Aprox 2 days ago it apear the error message:
I can not use any more: "getJSON request failed!"
$.getJSON('https://api.thingspeak.com/channels/'+channelNumber+'/feed.json?&offset=0&results=2500;key='+key, function(data)
It is not about cookies, because even in private windows I get same error.
Firefox in debug windows yelling:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.thingspeak.com/channels/795411/feed.json?&offset=0&results=2500;key=Z67C5TON0V5UU0M6. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

My script worked till now, and I didn't change nothing on it. This errpr does not depent on browser.
What I need to change to be able to use again?
Thx
採用された回答
Vinod
2021 年 4 月 15 日
The underlying issue has been fixed. A missing response header from the server caused your browser to not make any XHR requests.
Can you confirm your code is working again?
12 件のコメント
Isidor Pol
2021 年 4 月 15 日
Woow.
Thank you for quick respond.
Yes it working!
Only what I can notice that now tohe loding of graph is aprox 50% slower than it was.
Os it posible?
Vinod
2021 年 4 月 15 日
The slowness is likely unrelated to changes on our end.
Isidor Pol
2021 年 4 月 15 日
Anyway..thank you for fixing!
R W
2021 年 4 月 16 日
Had the same problem and it is now working again.
Thank you for fixing!
Andrew sustainablesv
2021 年 4 月 22 日
I don't believe this is fixed for me. Just started receiving the same CORS-related errors and have tried with both Safari and Chrome (which is fully CORS enabled.) Here's what I get:

Please advise when this will be fixed. Thanks.
Vinod
2021 年 4 月 22 日
Can you provide a link to your site or provide the HTML code that reproduces the issue, Andrew?
Andrew sustainablesv
2021 年 4 月 22 日
Hi Vinod, here is a link to the application but I can't really provide a simplified HTML code just now:
BackpAQ Name: BP2-EPA
Start Date: 4/1/21 (pick date on calendar)
End Date: 4/21/21 (pick date on calendar)
Once you enter the second date the data should display in both the map and the graph. They fail due to the CORS error, which may be viewed in the console. Thanks again!
Drew
Isidor Pol
2021 年 4 月 22 日
It is imposible for me to set the date.
Andrew sustainablesv
2021 年 4 月 22 日
Hi..you have to use the calendar date picker, not enter an actual date. You just click in the box and a calendar month will show. Then, click on April 1 for start date and April 21 for end date. Thanks,
Andrew Clark
2021 年 4 月 22 日
編集済み: Andrew Clark
2021 年 4 月 23 日
Vinod, here is some minimal HTML code that shows the CORS error. I am using fetch which is the more modern replacement for XHR-type calls. This code has been working great until this week. If I execute the API call from the browser (or CURL) it succeeds, so I know the Thingspeak data is ok. And it fails using the regular jQuery "$.getJSON(" calls as well. Did Thingspeak somehow lose the "alllow CORS" in the response header? See https://stackoverflow.com/questions/67101121/no-access-control-allow-origin-thingspeak for more examples of this fail.
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<title>BackpAQ Track Search</title>
<meta name="author" content="Andrew Clark">
</head>
<body>
<script>
//var startDate =
//var endDate =
var bpChannel = "1278482"; // public channel
const unitsPM = "µg/m³";
// fetch the (selected) data from ThingSpeak
function loadData() {
var result;
// prototype: fetch('https://api.thingspeak.com/channels/1278482/feeds.json?api_key=xxxxxxxxxxxx&results=100' ,{
fetch('https://api.thingspeak.com/channels/' + bpChannel + '/feed.json?results=2000&timezone=America%2FLos_Angeles', {
method: 'GET', // or 'PUT'
headers: {
'Content-Type': 'application/json',
},
})
.then(response => response.json())
.then(data => {
console.log('Success:', data);
var jParse = JSON.stringify(data, null, 2); // parse and pretty
console.log(jParse);
})
.catch((error) => {
console.error('Error:', error);
});
} // loadData
loadData(); // go fetch
</script>
</body>
</html>
Vinod
2021 年 4 月 23 日
Thanks for the HTML. I'm able to reproduce the issue with this. I believe in certain cases the required header is not being added at the server end. We'll look into this and provide resolution shortly.
Andrew Clark
2021 年 4 月 23 日
OK thanks!
その他の回答 (0 件)
コミュニティ
その他の回答 ThingSpeak コミュニティ
カテゴリ
ヘルプ センター および File Exchange で Write Data to Channel についてさらに検索
製品
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
