Skip to content

Instantly share code, notes, and snippets.

@gcaixeta
Last active October 10, 2017 19:38
Show Gist options
  • Save gcaixeta/54014255e03d3996e443 to your computer and use it in GitHub Desktop.
Save gcaixeta/54014255e03d3996e443 to your computer and use it in GitHub Desktop.
archive all messages at couchsurfing
https://www.couchsurfing.com/messages?per_page=6000
var data = { '_method' : 'patch',
'authenticity_token' : jQuery('meta[name="csrf-token"]').attr('content')
}
jQuery('.inbox-thread__item').each(
function(i,e){
var id = jQuery(e).attr('id')
console.log(id);
var url = 'https://www.couchsurfing.com/messages/' + id + '/archive';
$.ajax({
type: "POST",
url: url,
data: data,
success: function( data ) { console.log(data);}
});
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment