Jacob Warner in MATLAB Answers
Letzte Aktivitätam 8 Apr. 2024

Okay, I've tried a few different ways to post to any channel I've created but haven't had any success. I'm going to throw up a channel for anyone else to try and post to just in case I'm doing something way wrong. Originally I tried to post temerature data from a nodemcu/esp8266 and when that didn't work I set up another channel and used Postman to try and send data. That didn't work either. I can do GET requests to see channel info but I can't get any data to post to the channel. Any help is appreciated. I made a test channel and made it public just to see if anyone can post to it. It's just a single field and on a free account so don't go crazy. https://thingspeak.com/channels/897564 write: KYY2MERT251RV2OM read: S325VXRJTWDUZQRI Postman: GET https://api.thingspeak.com/channels.json?api_key=XXXXXXXXXXXXXXXXX (Not sharing my account key but JSON results show the channel) [ { "id": 897564, "name": "testCount", "description": "", "latitude": "0.0", "longitude": "0.0", "created_at": "2019-10-29T23:06:45Z", "elevation": "", "last_entry_id": null, "public_flag": true, "url": "", "ranking": 30, "metadata": "", "license_id": 0, "github_url": null, "tags": [], "api_keys": [ { "api_key": "KYY2MERT251RV2OM", "write_flag": true }, { "api_key": "S325VXRJTWDUZQRI", "write_flag": false } ] } ] Tried both the GET and POSTMAN tutorials here with no luck: https://www.mathworks.com/help/thingspeak/writedata.html Any attempt to use a GET or POST to update the channel (field1) results in a return of '0' or 401, which I think means that Thingspeak is not recognizing my write API key. I've had the same problem on multiple channels. Much appreciate any help. Please let me know if you need more information.
Jakub R in MATLAB Answers
Letzte Aktivitätam 18 Sep. 2022

Hello, I have a problem to write a bulk-update using csv format. I have some experience with thingspeak using JSON update method, but I need to change it because *csv format would be more RAM-saving method in case of bulk update (less characters = less memory needed). I was trying to change my code written for JSON method to csv according to instructions: https://www.mathworks.com/help/thingspeak/bulkwritecsvdata.html but my example-string csv_feed is not accepted by Thingspeak server. I don't have ideas where is the problem, I tried to comment "//" some non-necessery lines, because in API's example, those lines doesn't appears in code. Thingspeak response code is always the same: 401, meaning "authorization required". But I wrote in code "write_api_key" properly I think (I'm sure that API key and channel number is the same as it is in channel settings on Thingspeak page). The key is authentic, I don't have important data on this channel and I'll change the key after getting rid problems with that code. Without success, I've been changing csv_feed content with diffrent time format (I'd like to use EPOCH time), diffrent number of commas representing field values and I'm still stuck with that code. Could anybody show my mistake? Thank you in advance, Jakub char csv_feed[] = "write_api_key%3DxxxxxxxxxxxxxxxxC%26time_format%3Dabsolute%26updates%3D1662883022%2C20%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C"; String csv_lenght = String(strlen(csv_feed)+1); if(client.connect(server, 80)){ client.println("POST /channels/647137/bulk_update.csv HTTP/1.1"); client.println("Host: api.thingspeak.com"); //client.println("User-Agent: mw.doc.bulk-update (Arduino ESP8266)"); //client.println("Connection: close"); client.println("Content-Type: application/x-www-form-urlencoded"); client.println("time_format: absolute"); //client.println("write_api_key: xxxxxxxxxxxxxxxx"); client.println("Content-Length: "+csv_lenght); client.println(); client.println(csv_feed);
Peter Reiter in MATLAB Answers
Letzte Aktivitätam 5 Nov. 2021

Dear all, I have created an HTTP post with the corresponding REACT to send various measurement data of a bee hive to beep.nl. Unfortunately, the data does not arrive there although I was able to successfully transmit data with Postman which was then also written to the database (JSON an also with X-WWW-FORM). I can't explain what content error I have in the body? Unfortunately, my knowledge of MATHLAB is not sufficient to create a post from this. Thanks a lot in advance regards Peter -------------------------------------------------- Name:Beute 2 API Key:52G8X93X1UTSHH6K URL:https://api.beep.nl/api/sensors?key=kptnnz7wrz3qy90c HTTP Auth Username: HTTP Auth Password: Method:POST Content Type:application/json HTTP Version:1.1 Host:api.beep.nl Headers: Body:{"weight_kg"=%%channel_1293353_field_6%%, "h"=%%channel_1293353_field_3%%, "t"=%%channel_1293353_field_1%%, "p"=%%channel_1293353_field_4%%, "t"=%%channel_1293353_field_2%%, t_i=%%channel_1293353_field_5%%} Parse String: Created:2021-10-16 4:50 am --------------------------------------------------------
theo koster in MATLAB Answers
Letzte Aktivitätam 17 Feb. 2021

Using google app script I want to post measurements from my home domotics to a thingspeak channel. The chart has several charts. I am using the following code POST https://api.thingspeak.com/update.json api_key=XXXXXXXXXXXXXXXX field1=73 and after a few seconds POST https://api.thingspeak.com/update.json api_key=XXXXXXXXXXXXXXXX field2=100. In the channel it only updates the chart for field1. When I introduce a sleep of 15 seconds between the 2 posts, it will show both charts (field1 and field2). It seems not possible to send both posts with short intermediant times to update the both charts. Or should I use another way to achieve almost simultaneous updates of multiple charts ?
AMMAS in MATLAB Answers
Letzte Aktivitätam 5 Apr. 2020

Hey guys, I have been researching and I am trying to build a function that posts the output of a sensor to thingspeak on the Arduino Yun. Here is my code so far, but I am getting no success, unfortunately. After looking up on the internet, everywhere I can, this is what I came up with. void postToThingSpeak(int value) { Process p; String cmd = "curl -d 'key=XXXXXXXXXXXXXXXXX&field1="; cmd = cmd + value; cmd = cmd + "' -k http://api.thingspeak.com/update"; p.runShellCommand(cmd); Serial.println(cmd); // do nothing until the process finishes, so you get the whole output: while(p.running()); } PS: I took the cmd after it was printed, and ran it in terminal and it worked perfectly. For some reason it's not working on the Arduino Yun though. Any assistance would be appreciated, thank you very much!
Emilio Rubio Garcia in MATLAB Answers
Letzte Aktivitätam 24 Jan. 2020

Hi, There is some kind of problem in one of my channels (Weather Station). Data is not showing in downloaded data file although channel is reflecting that there are already some records. I've recently changed POST procedure by GET in software, but it is not still showing data. Should I change anything else in code for data to appear? Thank you very much in advance for your support. Regards. Emilio Rubio.
Björn Skatt in File Exchange
Letzte Aktivitätam 5 Aug. 2015

Really simple IoT writer tool - adding data bursts, named fields and efficency option

Info zu ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.