Deleting a bunch of stikkits is not that hard, it just needs a separate call for each stikkit. The following PHP code should do the trick. Simply fill in API key and use at YOUR OWN RISK. You need to uncomment the deleteStikkit line to make the script do the deletions. The script must be called repeatedly until no more stikkits are found.
You can filter by kind or tag, but I have found inconsistent results when using kind. If you are simply after deleting calendar entries, I suggest uncommenting the line that forces the script to work with calendar entries.
You will also need two PHP packages:
HTTP_Request and
Services_JSON.
<?php
ini_set("include_path", ini_get('include_path').";./PEAR;C:/aCode/PHP/");
require_once "HTTP/Request.php";
require_once "JSON/JSON.php";
$apikey="api_key=xxxx";
$EVENTS=2;
$TODOS=128;
$PEEPS=32;
$BOOKMARKS=1;
// delete all events found
deleteAllStikkits(1,null,$EVENTS);
function deleteAllStikkits($page=1,$tag=null,$stikkitKind=255) {
global $apikey;
$param="page=$page&kind=$stikkitKind";
if(isset($tag)) $param.="&tags=$tag";
// uncomment the next line to make the request work with only calendar stikkits
//$reqstr="http://api.stikkit.com/calendar?$apikey&$param";
// uncomment the next line to make the request work for all stikkits
$reqstr ="http://api.stikkit.com/stikkits?$apikey&$param";
$req =& new HTTP_Request($reqstr);
$req->setMethod(HTTP_REQUEST_METHOD_GET);
$req->addHeader("Accept", "application/json, */*");
$res=stikkitAPI($req);
$num=sizeof($res);
echo("<p>$reqstr<br />$num stikkits found.</p>");
for($i=0; $i<$num; $i++) {
echo("Would have deleted stikkit ID ".$res[$i]["id"]." - ".$res[$i]["name"]."<br />\n");
// uncomment to delete the stikkit.
// deleteStikkit($res[$i]["id"]);
}
}
function stikkitAPI($req) {
$response = $req->sendRequest();
if (PEAR::isError($response)) echo $response->getMessage();
else {
$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
$value = $json->decode($req->getResponseBody());
return $value;
}
}
function deleteStikkit($id) {
global $apikey;
$req =& new HTTP_Request("http://api.stikkit.com/stikkits/$id?$apikey");
$req->setMethod(HTTP_REQUEST_METHOD_DELETE);
$res=stikkitAPI($req);
echo("<p>Deleted stikkit: $id</p>\n");
}
?>