Skip to content

Instantly share code, notes, and snippets.

@judismith
Created August 21, 2012 03:07
Show Gist options
  • Save judismith/3411152 to your computer and use it in GitHub Desktop.
Save judismith/3411152 to your computer and use it in GitHub Desktop.
Delete projects through Basecamp Next API from list in file
require 'net/https'
require 'uri'
require 'rubygems'
require 'json/pure'
@user = 'username'
@pass = 'password'
file = File.new("bc_proj.txt", "r")
while (@line = file.gets)
# replace 9999999 with your instance id
@path = '/9999999/api/v1/projects/' + @line.gsub("\n", '') + '.json'
puts @path.inspect
uri = URI.parse('https://basecamp.com')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
req = Net::HTTP::Delete.new(@path)
req.add_field('User-Agent', 'MyApp (you@you.com)')
req.basic_auth @user, @pass
resp = http.request(req)
puts resp.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment