Contenido principal

Resultados de

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!

Hello

From earlier today a project i've been working on has stopped working. It was working for the last couple of weeks with no coding updates in the mean time.

The error i'm only now getting is

"from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

Im transferring four readings from thingspeak to a web page

the get command i'm using is. xhttp.open("GET", "https://api.thingspeak.com/channels/752230/feeds/last", false); xhttp.send();

Why would i only start receiving this error today. If more information is needed i will send it on.

any insights would be much appreciated.

Thanks

Trev