10:58 am

December 15, 2020

I am trying to use this app to clean the channels, I found this code:
ChannelID = "MY Channel
I've already changed it"
UserAPIKey = "My API
I've already changed it"
url = sprintf('https://api.thingspeak.com/channels/%s/feeds.json?api_key=%s',num2str(ChannelID),UserAPIKey)
response = webwrite(url, weboptions('RequestMethod','delete'))
Which supposedly does but at the time of making it work gives me the following error:
Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 373)
The server returned the status 401 with message "" in response to the request to URL https://api.thingspeak.com/channels/....
Error in readContentFromWebService (line 46)
byteArray = copyContentToByteArray(connection);
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
Error in Custom (no starter code) 1 (line 4)
response = webwrite(url, weboptions('RequestMethod','delete'))
My channel is public, so it should not be due to any access restriction.
6:10 pm


Moderators
March 7, 2017

FYI, MATLAB answers is the preferred location for ThingSpeak Community support.
Looks like you have the format correct.
https://api.thingspeak.com/channels//feeds.
Clearing and deleting both private and public channels requires the user API key, so the access restriction is the same in both cases. Are you using the user API key or the write API key?
Most Users Ever Online: 166
Currently Online:
24 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
JadeFloralde98, mgnthe54, Zain-Ul-Abidin, wellbeingcentresuk, Vamsi, frankmehlhopModerators: cstapels: 460
Administrators: Hans: 405, lee: 457