Skip to content

Instantly share code, notes, and snippets.

@judismith
Created August 21, 2012 03:02
Show Gist options
  • Save judismith/3411111 to your computer and use it in GitHub Desktop.
Save judismith/3411111 to your computer and use it in GitHub Desktop.
Ruby script to get all projects from Basecamp Next API to file
require 'net/https'
require 'uri'
# replace 9999999 with your instance id
@path = '/9999999/api/v1/projects.json'
@user = 'username'
@pass = 'password'
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::Get.new(@path)
req.add_field('User-Agent', 'MyApp (you@you.com)')
req.basic_auth @user, @pass
response = http.request(req)
resp = response.body
File.open('bc_proj.txt', 'w') {|f| f.write(resp)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment