Delete all objects in Brightkite

2 views
Skip to first unread message

carsten_

unread,
Oct 28, 2009, 9:39:29 AM10/28/09
to Brightkite API
Hi guys!

I wrote a little script in Groovy a few days ago to delete all my
objects in Brightkite. Maybe someone is interested in it, so here
comes the code:

def user = "USERNAME"
def password = "PASSWORD"
def notes = ""

while(notes != null) {
def h = new GroovyHTTP("http://brightkite.com/people/${user}/
objects.xml")
h.setMethod('GET')
h.setAuthorization(user, password)
h.open()
h.write()
h.read()
def content = h.getContent()
h.close()

def xml = new XmlSlurper().parseText(content)
notes = xml.depthFirst().findAll{it.note != null}
notes = notes.findAll {it.id != ""}
notes.each {
def url = "http://brightkite.com/objects/${it.id}.xml"
h = new GroovyHTTP(url);
h.setMethod('DELETE')
h.setAuthorization(user, password)
h.open()
h.write()
println "Deleted ${it.id}"
}
}

You can find it on http://wiki.kopis.de/doku.php/loeschen_aller_objekte_in_brightkite
with syntax highlighting.

Have fun
Reply all
Reply to author
Forward
0 new messages