I'll start by apologizing for my abysmal familiarity with HTTP, JSON, and URL's ... I'm hoping someone will have pity and give me a hand!
I am trying to send a "command" to a ThingSpeak channel, which is very successfully receiving data from a simple little ESP8266 module. Periodically, I need to clear the data from this channel. I want to do so from LC.. NOT the ESP8266. I just can't seem to "coordinate" the instructions from the ThingSpeak site to DELETE this data (not the channel, just the data within) with an LC function / code. The link to the ThingSpeak page I am referring to is: https://www.mathworks.com/help/thingspeak/clearchannel.html?searchHighlight=delete%20channel%20data&s_tid=doc_srchtitle#d120e16923 but in essence, I interpret the content to assert the following: Access the following URL: "https://api.thingspeak.com/channels/564256/feeds.json" where "564256" is the channel I wish to clear. Send the JSON "command": "DELETE https://api.thingspeak.com/channels/564256/feeds.json api_key= EQKTUQQKVH83D1RE" where "EQKTUQQKVH83D1RE" is my account api-key for writing to the ThingSpeak channel if successful, ThingSpeak responds with: "" ... an empty JSON array In LC, I've tried the following (and several variations): on mouseUp put empty into field "Output" put "https://api.thingspeak.com/channels/564256/feeds.json" into tUrl put "DELETE https://api.thingspeak.com/channels/564256/feeds.xml" & return & "api_key=EQKTUQQKVH83D1RE" into JsonCmd -- Send a HTTP DELETE request put tsNetCustomSync(tUrl, JsonCmd, tHeader, tResponseHeaders, tResult, tBytes) into tData -- If this is not the case, we will inform the user put tResult into field "Output" end mouseUp I get a tResult of 0 (zero) ... but the data is NOT cleared. I have also tried the following: on mouseUp put empty into field "Output" put "https://api.thingspeak.com/channels/564256/feeds.json?api_key=EQKTUQQKVH83D1RE" into tUrl put "DELETE https://api.thingspeak.com/channels/564256/feeds.json" & return & "api_key=EQKTUQQKVH83D1RE" into tMessage["text"] put ArrayToJSON(tMessage) into tMessage set the httpHeaders to "Content-type: application/json" post tMessage to url tUrl put it into field "Output" end mouseUp But that only "creates" a new entry in the channel with all of the data fields empty. I'm sure it's the way in which I am trying to send the "DELETE" command but I just can't see how to do it correctly. I'd be grateful for any assistance. Douglas Ruisaard Trilogy Software (250) 573-3935 _______________________________________________ use-livecode mailing list email@example.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode