Main Content

Results for

Hello, I need help with a simple example. I am trying to do a simple bulk update using JSON in Javascript, using this parm, header and body:
$.post("https://api.thingspeak.com/channels/xxxxxxxxx/bulk_update.json" ,{
"Content-Type": "application/json",
"write_api_key" : "xxxxxxxxxxxxxxxx",
"updates": [
{
"created_at": "2022-12-30 10:26:2 -0800",
"field1": 100,
"field2": 100,
"field3": 200,
"field5": 600
},
{
"created_at": "2022-01-12 10:27:2 -0800",
"field2": 100,
"field3": 200,
"field5": 600
}],
function(data){
console.log(data) // log anything returned to the console
}
});
When I run the above (Mac OS, Chrome, Javascript) I receive this error message:
Access to XMLHttpRequest at 'https://api.thingspeak.com/channels/1283582/bulk_update.json' from origin 'https://backpaqlabs.com'
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
api.thingspeak.com/channels/1283582/bulk_update.json:1
Failed to load resource: net::ERR_FAILED
Is there something wrong with the syntax or JSON payload that can cause this CORS error? I have tried both local command line and from my hosted server. I am starting to see CORS errors with Javascript getJSON calls as well, so wondering if there is something going on at the endpoint. In this example, I have literally taken it from the example in the doc, so I assume it should comply with the API endpoint. Does seem to work OK with same code on Postman and CURL, so I believe syntax is correct. Ideas?
Any help appreciated!

Hi everyone. I updated my IoT Debugger project on GitHub. You can use the debugger to view channel data from ThingSpeak.

Hi all, The ThingSpeak API provides the possibility to embed the chart with historical values of a channel in a web page. Now I would also like to show the last value of a channel as a number on this page. I looked into some of the answers. But I could not understand. Can someone please share the JavaScript code OR the HTML code? I am new to ThingSpeak and Web Development. Please help me out!!

Thank you, Prajna Bhat