MATLAB Answers

Thingspeak, Delete channel with HTTP DELETE, webwrite

7 views (last 30 days)
Hey there,
I want to delete a thingspeak channel using the webwrite function. This is what it looks like:
url = ['' channelID '.json']
options = weboptions('RequestMethod','delete', 'MediaType','application/x-www-form-urlencoded');
response = webwrite(url,'api_key',userAPIkey,options)
This returns status 401 Unauthorized. But if I only change the RequestMethod to 'put', I don't get any errors. But using 'put' only allows me to change the channel settings. How do I delete the channel using webwrite?


Sign in to comment.

Accepted Answer

Christopher Stapels
Christopher Stapels on 6 Feb 2020
Make the api_key a querry string parameter.
url = ['' channelID '.json?api_key=<userAPIKey>']
options = weboptions('RequestMethod','delete');
response = webwrite(url);

More Answers (0)

Sign in to answer this question.