Skip to content

Instantly share code, notes, and snippets.

@jhoguet
Created June 21, 2015 15:28
Show Gist options
  • Save jhoguet/95c36c64c02cf17684f4 to your computer and use it in GitHub Desktop.
Save jhoguet/95c36c64c02cf17684f4 to your computer and use it in GitHub Desktop.
How do I delete all the jobs in my sauce labs account?
var SauceLabs = require('saucelabs');
var myAccount = new SauceLabs({
username: "...",
password: "..."
});
myAccount.getJobs(function (err, jobs) {
jobs.forEach(function(job){
myAccount.send({
method : 'DELETE',
path : ':username/jobs/' + job.id
}, function(err){
if (err){
console.log('failed to delete ' + job.id + ' ' + err.toString());
}
else {
console.log('deleted', job.id);
}
});
});
});
@jhoguet
Copy link
Author

jhoguet commented Jun 21, 2015

this doesn't do the paging, so just run the script until there are no more to delete

@jhoguet
Copy link
Author

jhoguet commented Jun 21, 2015

there appears to be some caching where the api will return none, but you still may seem them in the ui...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment